diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2013-02-11 18:09:51 +0100 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2013-02-11 18:09:51 +0100 |
commit | 891ee79bc292705dd56035a5dca20d8ff6371e50 (patch) | |
tree | 27d7fb770428d52dcb286017823126d7372fcb12 /src | |
parent | aeefc20a3100ec91d201d18db53c86e760782d9f (diff) | |
download | sciteco-891ee79bc292705dd56035a5dca20d8ff6371e50.tar.gz |
support <CTRL/W> 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
Diffstat (limited to 'src')
-rw-r--r-- | src/cmdline.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
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<StateExpectString *>(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<StateExpectString *>(States::current) && + !strchr(wchars, cmdline[macro_pc-1])); + + /* rubout word chars */ + while (dynamic_cast<StateExpectString *>(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<StateExpectString *>(States::current)) { const gchar *filename = last_occurrence(strings[0]); |