aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2025-03-29 16:25:48 +0300
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2025-03-29 16:25:48 +0300
commit62a9c8d112e33d1202c8562744bddfa102c1f96e (patch)
tree1156239565e31b96eb93bdd539a5fb0715a572d5
parentca0d7656b606703f1b5b52e59f0b46ca0038477e (diff)
downloadsciteco-62a9c8d112e33d1202c8562744bddfa102c1f96e.tar.gz
^W also rubs out/in `@` and `:` modifiers
* It makes little sense to e.g. rub out until `I` in `@I/foo/`, but leave the `@` modifier. Modifiers have to be considered part of the command, even though the state machine is not currently modelled like that.
-rw-r--r--doc/sciteco.7.template3
-rw-r--r--src/cmdline.c15
2 files changed, 18 insertions, 0 deletions
diff --git a/doc/sciteco.7.template b/doc/sciteco.7.template
index c250728..2a97c02 100644
--- a/doc/sciteco.7.template
+++ b/doc/sciteco.7.template
@@ -515,6 +515,7 @@ Miscelleaneous
(modifier \fIdisabled\fP)
T};T{
Rub out until the beginning of the last command, which is not a no-op (whitespace).
+\(lq@\(rq and \(lq:\(rq modifiers are considered part of the command and also rubbed out.
T}
T{
Re-insert word/command
@@ -542,6 +543,8 @@ Miscelleaneous
T};T{
Re-insert next command from the rubbed-out command line
including all subsequent no-ops (whitespace).
+\(lq@\(rq and \(lq:\(rq modifiers are considered part of the command and
+also re-inserted.
T}
T{
.SCITECO_TOPIC ^U
diff --git a/src/cmdline.c b/src/cmdline.c
index 25b7b98..3fb7cb9 100644
--- a/src/cmdline.c
+++ b/src/cmdline.c
@@ -456,6 +456,14 @@ teco_state_process_edit_cmd(teco_machine_t *ctx, teco_machine_t *parent_ctx, gun
*/
if (teco_cmdline.modifier_enabled) {
/* reinsert command */
+ /* @ and : are not separate states, but practically belong to the command */
+ while (ctx->current->is_start &&
+ teco_cmdline.effective_len < teco_cmdline.str.len &&
+ (teco_cmdline.str.data[teco_cmdline.effective_len] == ':' ||
+ teco_cmdline.str.data[teco_cmdline.effective_len] == '@'))
+ if (!teco_cmdline_rubin(error))
+ return FALSE;
+
do {
if (!teco_cmdline_rubin(error))
return FALSE;
@@ -481,6 +489,13 @@ teco_state_process_edit_cmd(teco_machine_t *ctx, teco_machine_t *parent_ctx, gun
teco_cmdline_rubout();
while (!ctx->current->is_start);
+ /* @ and : are not separate states, but practically belong to the command */
+ while (ctx->current->is_start &&
+ teco_cmdline.effective_len > 0 &&
+ (teco_cmdline.str.data[teco_cmdline.effective_len-1] == ':' ||
+ teco_cmdline.str.data[teco_cmdline.effective_len-1] == '@'))
+ teco_cmdline_rubout();
+
return TRUE;
#if !defined(INTERFACE_GTK) && defined(SIGTSTP)