* PATCH: compstate[insert]
@ 1999-06-29 7:01 Sven Wischnowsky
0 siblings, 0 replies; only message in thread
From: Sven Wischnowsky @ 1999-06-29 7:01 UTC (permalink / raw)
To: zsh-workers
We were talking about this lately and I had already prepared it...
With this you can get insertion as for normal completion (i.e. with
the space appended) when using compstate[insert]='1 ': it's the
trailing space that triggers it. There are probably better solutions,
but at least I don't want to have another compstate-key just for this.
Bye
Sven
diff -u os/Zle/zle_tricky.c Src/Zle/zle_tricky.c
--- os/Zle/zle_tricky.c Mon Jun 28 16:18:37 1999
+++ Src/Zle/zle_tricky.c Mon Jun 28 22:55:07 1999
@@ -98,7 +98,7 @@
/* The match and group number to insert when starting menucompletion. */
-static int insmnum, insgnum, insgroup;
+static int insmnum, insgnum, insgroup, insspace;
/* This is used to decide when the cursor should be moved to the end of *
* the inserted word: 0 - never, 1 - only when a single match is inserted, *
@@ -4701,6 +4701,7 @@
insgroup = 1;
insgnum = atoi(m + 1);
}
+ insspace = (compinsert[strlen(compinsert) - 1] == ' ');
} else
useline = usemenu = 0;
useexact = (compexact && !strcmp(compexact, "accept"));
@@ -7653,7 +7654,7 @@
inststrlen(&(m->autoq), 1, 1);
minfo.insc++;
}
- if (!menucmp && usemenu != 3) {
+ if (!menucmp && (usemenu != 3 || insspace)) {
inststrlen(" ", 1, 1);
minfo.insc++;
if (minfo.we)
diff -u od/Zsh/compwid.yo Doc/Zsh/compwid.yo
--- od/Zsh/compwid.yo Mon Jun 28 22:54:54 1999
+++ Doc/Zsh/compwid.yo Mon Jun 28 23:06:39 1999
@@ -238,7 +238,9 @@
Negative numbers count backward from the last match or group (with `tt(-1)'
selecting the last match or group) and out-of-range values are wrapped
around, so that a value of zero selects the last match or group and a value
-one more than the maximum selects the first.
+one more than the maximum selects the first. Unless the value of this
+key ends in a space, the match is inserted as in a menu-completion,
+i.e. without automatically appending a space.
)
item(tt(to_end))(
Specifies the occasions on which the cursor is moved to the end of a string
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~1999-06-29 7:02 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-06-29 7:01 PATCH: compstate[insert] Sven Wischnowsky
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).