(input_execute_cmd): refactoring.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2015-01-21 10:00:00 +03:00
parent 964056fb65
commit c08c90cd1b

View File

@ -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;
}