zsh-workers
 help / color / mirror / code / Atom feed
From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: PATCH: compstate[insert]
Date: Tue, 29 Jun 1999 09:01:34 +0200 (MET DST)	[thread overview]
Message-ID: <199906290701.JAA20538@beta.informatik.hu-berlin.de> (raw)


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


                 reply	other threads:[~1999-06-29  7:02 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199906290701.JAA20538@beta.informatik.hu-berlin.de \
    --to=wischnow@informatik.hu-berlin.de \
    --cc=zsh-workers@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).