summaryrefslogtreecommitdiff
path: root/plugins/manipulator.cpp
diff options
context:
space:
mode:
authorjj2012-09-28 18:58:58 +0200
committerjj2012-09-28 19:48:28 +0200
commit687657f2da175db827109384737d6a2220cf1c32 (patch)
treee58597035efdce7ecdc1d7c81a6eb5ad492df94c /plugins/manipulator.cpp
parent4a495c2c7fa9cef78628a3026a434322ca7418d1 (diff)
downloaddfhack-687657f2da175db827109384737d6a2220cf1c32.tar.gz
dfhack-687657f2da175db827109384737d6a2220cf1c32.tar.bz2
dfhack-687657f2da175db827109384737d6a2220cf1c32.tar.xz
manipulator: show full group when navigating labor groups
Diffstat (limited to 'plugins/manipulator.cpp')
-rw-r--r--plugins/manipulator.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/plugins/manipulator.cpp b/plugins/manipulator.cpp
index b04c8079..953cf2ba 100644
--- a/plugins/manipulator.cpp
+++ b/plugins/manipulator.cpp
@@ -662,6 +662,17 @@ void viewscreen_unitlaborsst::feed(set<df::interface_key> *events)
if (sel_column > NUM_COLUMNS - 1)
sel_column = NUM_COLUMNS - 1;
+ if (events->count(interface_key::CURSOR_DOWN_Z) || events->count(interface_key::CURSOR_UP_Z))
+ {
+ // when moving by group, ensure the whole group is shown onscreen
+ int endgroup_column = sel_column;
+ while ((endgroup_column < NUM_COLUMNS-1) && columns[endgroup_column+1].group == columns[sel_column].group)
+ endgroup_column++;
+
+ if (first_column < endgroup_column - col_widths[DISP_COLUMN_LABORS] + 1)
+ first_column = endgroup_column - col_widths[DISP_COLUMN_LABORS] + 1;
+ }
+
if (sel_column < first_column)
first_column = sel_column;
if (first_column < sel_column - col_widths[DISP_COLUMN_LABORS] + 1)