Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Space after completion disappears

On Wed, 22 Apr 2009 08:28:56 -0700 (PDT)
Michael Hwang <nomex45@xxxxxxxxx> wrote:
> Sorry Bart, that should have been sent to the mailing list, and not
> directly to you. I'm repeating my message for the benefit of everyone else:
> But my point is that it shouldn't, at least not for the last two cases I
> outlined.

It's entirely cosmetic, but if you really feel the need to change it it's
easy to make it configurable.

I hope I've got the documentation right.  I couldn't find the current
behaviour described anywhere.

Index: Doc/Zsh/compwid.yo
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/compwid.yo,v
retrieving revision 1.47
diff -u -r1.47 compwid.yo
--- Doc/Zsh/compwid.yo	13 Jan 2009 12:19:53 -0000	1.47
+++ Doc/Zsh/compwid.yo	22 Apr 2009 16:01:04 -0000
@@ -58,6 +58,11 @@
 texinode(Completion Special Parameters)(Completion Builtin Commands)()(Completion Widgets)
 sect(Completion Special Parameters)
+The parameter tt(ZLE_REMOVE_SUFFIX_CHARS) is used by the completion
+mechanism, but is not special.
+ifzman(See em(Parameters Used By The Shell) in zmanref(zshparam))\
+ifnzman(noderef(Parameters Used By The Shell)).
 Inside completion widgets, and any functions called from them, some
 parameters have special meaning; outside these functions they are not
 special to the shell in any way.  These parameters are used to pass
Index: Doc/Zsh/params.yo
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/params.yo,v
retrieving revision 1.53
diff -u -r1.53 params.yo
--- Doc/Zsh/params.yo	6 Apr 2009 09:06:36 -0000	1.53
+++ Doc/Zsh/params.yo	22 Apr 2009 16:01:04 -0000
@@ -1330,4 +1330,19 @@
 The directory to search for shell startup files (.zshrc, etc),
 if not tt($HOME).
+This parameter is used by the line editor.  In certain circumstances
+suffixes (typically space or slash) added by the completion system
+will be removed automatically, either because the next editing command
+was not an insertable character, or because the character was marked
+as requiring the suffix to be removed.  If this variable is set
+it contains the set of characters which will cause the suffix to be
+removed.  The default value is equivalent to
+example(ZLE_REMOVE_SUFFIX_CHARS=$' \t\n;&|')
+Note that certain completions may override this default set of characters
+in specific cases.
Index: Src/Zle/zle_misc.c
RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_misc.c,v
retrieving revision 1.57
diff -u -r1.57 zle_misc.c
--- Src/Zle/zle_misc.c	28 Jan 2009 09:32:01 -0000	1.57
+++ Src/Zle/zle_misc.c	22 Apr 2009 16:01:04 -0000
@@ -1278,8 +1278,21 @@
 mod_export void
 makesuffix(int n)
-    addsuffix(SUFTYP_POSSTR, ZWS(" \t\n;&|"), 6, n);
+    char *suffixchars;
+    ZLE_STRING_T suffixstr;
+    int slen, alloclen;
+    if (!(suffixchars = getsparam("ZLE_REMOVE_SUFFIX_CHARS")))
+	suffixchars = " \t\n;&|";
+    /* string needs to be writable... I've been regretting this for years.. */
+    suffixchars = ztrdup(suffixchars);
+    suffixstr = stringaszleline(suffixchars, 0, &slen, &alloclen, NULL);
+    addsuffix(SUFTYP_POSSTR, suffixstr, slen, n);
     suffixnoinslen = n;
+    zfree(suffixstr, alloclen);
+    zsfree(suffixchars);
 /* Set up suffix for parameter names: the last n characters are a suffix *

Messages sorted by: Reverse Date, Date, Thread, Author