diff --git a/lib/widget/input.c b/lib/widget/input.c index 0a12017b2..070c6dc36 100644 --- a/lib/widget/input.c +++ b/lib/widget/input.c @@ -684,26 +684,30 @@ input_execute_cmd (WInput * in, unsigned long command) { cb_ret_t res = MSG_HANDLED; - /* a highlight command like shift-arrow */ - if (command == CK_MarkLeft || command == CK_MarkRight || - command == CK_MarkToWordBegin || command == CK_MarkToWordEnd || - command == CK_MarkToHome || command == CK_MarkToEnd) + switch (command) { + case CK_MarkLeft: + case CK_MarkRight: + case CK_MarkToWordBegin: + case CK_MarkToWordEnd: + case CK_MarkToHome: + case CK_MarkToEnd: + /* a highlight command like shift-arrow */ if (in->mark < 0) { input_mark_cmd (in, FALSE); /* clear */ input_mark_cmd (in, TRUE); /* marking on */ } - } - - switch (command) - { + break; case CK_WordRight: case CK_WordLeft: case CK_Right: case CK_Left: if (in->mark >= 0) input_mark_cmd (in, FALSE); + break; + default: + break; } switch (command) @@ -807,10 +811,20 @@ input_execute_cmd (WInput * in, unsigned long command) res = MSG_NOT_HANDLED; } - if (command != CK_MarkLeft && command != CK_MarkRight && - command != CK_MarkToWordBegin && command != CK_MarkToWordEnd && - command != CK_MarkToHome && command != CK_MarkToEnd) + switch (command) + { + case CK_MarkLeft: + case CK_MarkRight: + case CK_MarkToWordBegin: + case CK_MarkToWordEnd: + case CK_MarkToHome: + case CK_MarkToEnd: + /* do nothing */ + break; + default: in->mark = -1; + break; + } return res; }