diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2015-05-29 17:30:47 +0200 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2015-05-29 17:30:47 +0200 |
commit | 6c62ccc436d972a872616c187d460ed61c8bc0d2 (patch) | |
tree | e7a5aca9263790283a90c975baec13daf96a7e39 | |
parent | b65eee089f048e04217009e5dbe70aef3f463230 (diff) | |
download | sciteco-6c62ccc436d972a872616c187d460ed61c8bc0d2.tar.gz |
Modified ^W in string (and file name) arguments: ensure that we always rub out beyond empty arguments
* it was annoying not to be able to rub out anything with ^W if the current string
argument was empty.
* Now, the special file name and string argument handling for ^W is effective
only if the current argument is non-empty, else we fall back to the rub-out-command
behaviour.
* So now, if you press ^W in a string argument, it is rubbed out until empty and
on the next ^W press, the entire command will be rubbed out.
-rw-r--r-- | doc/sciteco.7.template | 4 | ||||
-rw-r--r-- | src/cmdline.cpp | 20 | ||||
-rw-r--r-- | src/cmdline.h | 8 |
3 files changed, 25 insertions, 7 deletions
diff --git a/doc/sciteco.7.template b/doc/sciteco.7.template index 06db3b2..4fccd33 100644 --- a/doc/sciteco.7.template +++ b/doc/sciteco.7.template @@ -346,7 +346,7 @@ T} T{ Rub out word/command T};23;^W;T{ -File name arguments +Non-empty file name arguments .br (modifier \fIdisabled\fP) T};T{ @@ -355,7 +355,7 @@ last filename component up to but not inluding the preceding directory separator. T} \^;\^;\^;T{ -String arguments +Non-empty string arguments .br (modifier \fIdisabled\fP) T};T{ diff --git a/src/cmdline.cpp b/src/cmdline.cpp index a398b27..b85850a 100644 --- a/src/cmdline.cpp +++ b/src/cmdline.cpp @@ -301,7 +301,7 @@ Cmdline::process_edit_cmd(gchar key) if (States::is_file() && rubout_len && G_IS_DIR_SEPARATOR(str[len])) insert(); - } else { + } else if (strings[0] && *strings[0]) { /* rubout directory separator */ if (strings[0] && *strings[0] && G_IS_DIR_SEPARATOR(str[len-1])) @@ -311,6 +311,12 @@ Cmdline::process_edit_cmd(gchar key) while (strings[0] && *strings[0] && !G_IS_DIR_SEPARATOR(str[len-1])) rubout(); + } else { + /* + * Rub out entire command instead of + * rubbing out nothing. + */ + rubout_command(); } } else if (States::is_string()) { gchar wchars[interface.ssm(SCI_GETWORDCHARS)]; @@ -326,7 +332,7 @@ Cmdline::process_edit_cmd(gchar key) while (States::is_string() && rubout_len && !strchr(wchars, str[len])) insert(); - } else { + } else if (strings[0] && *strings[0]) { /* rubout non-word chars */ while (strings[0] && *strings[0] && !strchr(wchars, str[len-1])) @@ -336,6 +342,12 @@ Cmdline::process_edit_cmd(gchar key) while (strings[0] && *strings[0] && strchr(wchars, str[len-1])) rubout(); + } else { + /* + * Rub out entire command instead of + * rubbing out nothing. + */ + rubout_command(); } } else if (modifier_enabled) { /* reinsert command */ @@ -344,9 +356,7 @@ Cmdline::process_edit_cmd(gchar key) while (States::current != &States::start && rubout_len); } else { /* rubout command */ - do - rubout(); - while (States::current != &States::start); + rubout_command(); } break; diff --git a/src/cmdline.h b/src/cmdline.h index 11384c1..40a794a 100644 --- a/src/cmdline.h +++ b/src/cmdline.h @@ -79,6 +79,14 @@ private: } } + inline void + rubout_command(void) + { + do + rubout(); + while (States::current != &States::start); + } + void insert(const gchar *src = NULL); inline void insert(gchar key) |