aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2013-02-11 18:09:51 +0100
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2013-02-11 18:09:51 +0100
commit891ee79bc292705dd56035a5dca20d8ff6371e50 (patch)
tree27d7fb770428d52dcb286017823126d7372fcb12
parentaeefc20a3100ec91d201d18db53c86e760782d9f (diff)
downloadsciteco-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
-rw-r--r--src/cmdline.cpp24
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]);