aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--doc/sciteco.7.template17
-rw-r--r--src/cmdline.cpp30
2 files changed, 43 insertions, 4 deletions
diff --git a/doc/sciteco.7.template b/doc/sciteco.7.template
index cdd2bb7..06db3b2 100644
--- a/doc/sciteco.7.template
+++ b/doc/sciteco.7.template
@@ -346,6 +346,15 @@ T}
T{
Rub out word/command
T};23;^W;T{
+File name arguments
+.br
+(modifier \fIdisabled\fP)
+T};T{
+Rub out directory separator at end of filename and the
+last filename component up to but not inluding
+the preceding directory separator.
+T}
+\^;\^;\^;T{
String arguments
.br
(modifier \fIdisabled\fP)
@@ -365,6 +374,14 @@ T}
T{
Re-insert word/command
T};23;^W;T{
+File name arguments
+.br
+(modifier \fIenabled\fP)
+T};T{
+Re-insert next file name component up to and including the next
+directory separator from the rubbed-out command line.
+T}
+\^;\^;\^;T{
String arguments
.br
(modifier \fIenabled\fP)
diff --git a/src/cmdline.cpp b/src/cmdline.cpp
index 518c28c..a398b27 100644
--- a/src/cmdline.cpp
+++ b/src/cmdline.cpp
@@ -290,7 +290,29 @@ Cmdline::process_edit_cmd(gchar key)
case CTL_KEY('W'): /* rubout/reinsert word/command */
interface.popup_clear();
- if (States::is_string()) {
+ if (States::is_file()) {
+ if (modifier_enabled) {
+ /* reinsert one level of file name */
+ while (States::is_file() && rubout_len &&
+ !G_IS_DIR_SEPARATOR(str[len]))
+ insert();
+
+ /* reinsert final directory separator */
+ if (States::is_file() && rubout_len &&
+ G_IS_DIR_SEPARATOR(str[len]))
+ insert();
+ } else {
+ /* rubout directory separator */
+ if (strings[0] && *strings[0] &&
+ G_IS_DIR_SEPARATOR(str[len-1]))
+ rubout();
+
+ /* rubout one level of file name */
+ while (strings[0] && *strings[0] &&
+ !G_IS_DIR_SEPARATOR(str[len-1]))
+ rubout();
+ }
+ } else if (States::is_string()) {
gchar wchars[interface.ssm(SCI_GETWORDCHARS)];
interface.ssm(SCI_GETWORDCHARS, 0, (sptr_t)wchars);
@@ -306,12 +328,12 @@ Cmdline::process_edit_cmd(gchar key)
insert();
} else {
/* rubout non-word chars */
- while (strings[0] && strlen(strings[0]) > 0 &&
+ while (strings[0] && *strings[0] &&
!strchr(wchars, str[len-1]))
rubout();
/* rubout word chars */
- while (strings[0] && strlen(strings[0]) > 0 &&
+ while (strings[0] && *strings[0] &&
strchr(wchars, str[len-1]))
rubout();
}
@@ -338,7 +360,7 @@ Cmdline::process_edit_cmd(gchar key)
insert();
} else {
/* rubout string */
- while (strings[0] && strlen(strings[0]) > 0)
+ while (strings[0] && *strings[0])
rubout();
}
} else {