From 1374340aa2982b9ff0e53a61980a06f359dd46b9 Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Fri, 18 Mar 2011 11:58:33 +0300 Subject: [PATCH] Fixup of shift-arrow mark in editor. Signed-off-by: Andrew Borodin --- src/editor/edit.c | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/src/editor/edit.c b/src/editor/edit.c index 97596f91d..fb4e173f7 100644 --- a/src/editor/edit.c +++ b/src/editor/edit.c @@ -3441,18 +3441,38 @@ edit_execute_cmd (WEdit * edit, unsigned long command, int char_for_insertion) if (edit->found_len || edit->column_highlight) edit->force |= REDRAW_PAGE; - if (command / 100 == 6) - { /* a highlight command like shift-arrow */ + switch (command) + { + /* a mark command with shift-arrow */ + case CK_MarkLeft: + case CK_MarkRight: + case CK_MarkToWordBegin: + case CK_MarkToWordEnd: + case CK_MarkToHome: + case CK_MarkToEnd: + case CK_MarkUp: + case CK_MarkDown: + case CK_MarkPageUp: + case CK_MarkPageDown: + case CK_MarkToFileBegin: + case CK_MarkToFileEnd: + case CK_MarkToPageBegin: + case CK_MarkToPageEnd: + case CK_MarkScrollUp: + case CK_MarkScrollDown: + case CK_MarkParagraphUp: + case CK_MarkParagraphDown: edit->column_highlight = 0; - if (!edit->highlight || (edit->mark2 != -1 && edit->mark1 != edit->mark2)) + if (edit->highlight == 0 || (edit->mark2 != -1 && edit->mark1 != edit->mark2)) { edit_mark_cmd (edit, 1); /* clear */ edit_mark_cmd (edit, 0); /* marking on */ } edit->highlight = 1; - } - else - { /* any other command */ + break; + + /* any other command */ + default: if (edit->highlight) edit_mark_cmd (edit, 0); /* clear */ edit->highlight = 0;