From 891ee79bc292705dd56035a5dca20d8ff6371e50 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Mon, 11 Feb 2013 18:09:51 +0100 Subject: support immediate editing command: depending on context, rub out words or entire commands * when rubbing out words (in string params), use Scintilla's definition of a word --- src/cmdline.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/cmdline.cpp b/src/cmdline.cpp index 813b746..a2362bd 100644 --- a/src/cmdline.cpp +++ b/src/cmdline.cpp @@ -152,6 +152,30 @@ process_edit_cmd(gchar key) *insert = '\0'; break; + case CTL_KEY('W'): + if (dynamic_cast(States::current)) { + gchar wchars[interface.ssm(SCI_GETWORDCHARS)]; + interface.ssm(SCI_GETWORDCHARS, 0, (sptr_t)wchars); + + /* rubout non-word chars */ + do + undo.pop(macro_pc--); + while (dynamic_cast(States::current) && + !strchr(wchars, cmdline[macro_pc-1])); + + /* rubout word chars */ + while (dynamic_cast(States::current) && + strchr(wchars, cmdline[macro_pc-1])) + undo.pop(macro_pc--); + } else if (cmdline_len) { + do + undo.pop(macro_pc--); + while (States::current != &States::start); + } + cmdline[macro_pc] = '\0'; + *insert = '\0'; + break; + case CTL_KEY('T'): if (dynamic_cast(States::current)) { const gchar *filename = last_occurrence(strings[0]); -- cgit v1.2.3