Skip to content

Commit

Permalink
feat(selector): support vertical UI
Browse files Browse the repository at this point in the history
read context option "_vertical" and change Left, Right key behaviour accordingly.
  • Loading branch information
lotem committed Aug 16, 2020
1 parent 166f1ef commit dbb35c6
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions src/rime/gear/selector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,20 +56,30 @@ ProcessResult Selector::ProcessKeyEvent(const KeyEvent& key_event) {
if (ch == XK_Left || ch == XK_KP_Left) {
if (!key_event.ctrl() &&
!key_event.shift() &&
ctx->caret_pos() == ctx->input().length() &&
ctx->get_option("_horizontal") &&
CursorUp(ctx)) {
return kAccepted;
ctx->caret_pos() == ctx->input().length()) {
if (ctx->get_option("_horizontal") &&
CursorUp(ctx)) {
return kAccepted;
}
if (ctx->get_option("_vertical")) {
CursorDown(ctx);
return kAccepted;
}
}
return kNoop;
}
if (ch == XK_Right || ch == XK_KP_Right) {
if (!key_event.ctrl() &&
!key_event.shift() &&
ctx->caret_pos() == ctx->input().length() &&
ctx->get_option("_horizontal")) {
CursorDown(ctx);
return kAccepted;
ctx->caret_pos() == ctx->input().length()) {
if (ctx->get_option("_horizontal")) {
CursorDown(ctx);
return kAccepted;
}
if (ctx->get_option("_vertical") &&
CursorUp(ctx)) {
return kAccepted;
}
}
return kNoop;
}
Expand Down

0 comments on commit dbb35c6

Please sign in to comment.