diff options
| author | jj | 2012-09-28 10:44:35 +0200 |
|---|---|---|
| committer | jj | 2012-09-28 19:20:04 +0200 |
| commit | c4f26d0aa819e6038968d152c98198e48e52e8e1 (patch) | |
| tree | 5e8587463480b8cff78e14cecbbe7bb45480309f /plugins | |
| parent | 783b218eec3bc1b1c4c33f57700db39fc92069a4 (diff) | |
| download | dfhack-c4f26d0aa819e6038968d152c98198e48e52e8e1.tar.gz dfhack-c4f26d0aa819e6038968d152c98198e48e52e8e1.tar.bz2 dfhack-c4f26d0aa819e6038968d152c98198e48e52e8e1.tar.xz | |
manipulator: make up/down keys wrap around
Diffstat (limited to 'plugins')
| -rw-r--r-- | plugins/manipulator.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/plugins/manipulator.cpp b/plugins/manipulator.cpp index f3c6664a..d676dc2a 100644 --- a/plugins/manipulator.cpp +++ b/plugins/manipulator.cpp @@ -534,6 +534,8 @@ void viewscreen_unitlaborsst::feed(set<df::interface_key> *events) if (do_refresh_names) refreshNames(); + int old_sel_row = sel_row; + if (events->count(interface_key::CURSOR_UP) || events->count(interface_key::CURSOR_UPLEFT) || events->count(interface_key::CURSOR_UPRIGHT)) sel_row--; if (events->count(interface_key::CURSOR_UP_FAST) || events->count(interface_key::CURSOR_UPLEFT_FAST) || events->count(interface_key::CURSOR_UPRIGHT_FAST)) @@ -553,9 +555,20 @@ void viewscreen_unitlaborsst::feed(set<df::interface_key> *events) } if (sel_row < 0) - sel_row = 0; + { + if (old_sel_row == 0 && events->count(interface_key::CURSOR_UP)) + sel_row = units.size() - 1; + else + sel_row = 0; + } + if (sel_row > units.size() - 1) - sel_row = units.size() - 1; + { + if (old_sel_row == units.size()-1 && events->count(interface_key::CURSOR_DOWN)) + sel_row = 0; + else + sel_row = units.size() - 1; + } if (sel_row < first_row) first_row = sel_row; |
