aboutsummaryrefslogtreecommitdiff
path: root/lib/main.vala
diff options
context:
space:
mode:
Diffstat (limited to 'lib/main.vala')
-rw-r--r--lib/main.vala13
1 files changed, 5 insertions, 8 deletions
diff --git a/lib/main.vala b/lib/main.vala
index 170e0335..877d7b7b 100644
--- a/lib/main.vala
+++ b/lib/main.vala
@@ -890,19 +890,16 @@ public class Indicator.Keyboard.Service : Object {
if (length > 1) {
var current = old_current;
var offset = -((!) parameter).get_int32 () % length;
+ var jump = 1;
- /* Go backward. */
- for (; offset < 0; offset++) {
- do {
- current = (current + sources.length - 1) % sources.length;
- } while ((sources[current].is_ibus && !is_ibus_active ()) ||
- (sources[current].is_fcitx && !is_fcitx_active ()));
+ if (offset < 0) {
+ offset = -offset;
+ jump = sources.length - jump;
}
- /* Go forward. */
for (; offset > 0; offset--) {
do {
- current = (current + 1) % sources.length;
+ current = (current + jump) % sources.length;
} while ((sources[current].is_ibus && !is_ibus_active ()) ||
(sources[current].is_fcitx && !is_fcitx_active ()));
}