zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@csr.com>
To: zsh-workers@sunsite.dk
Subject: Re: Space after completion disappears
Date: Wed, 22 Apr 2009 17:04:20 +0100	[thread overview]
Message-ID: <20090422170420.6c5e5d36@news01> (raw)
In-Reply-To: <850582.49667.qm@web37305.mail.mud.yahoo.com>

On Wed, 22 Apr 2009 08:28:56 -0700 (PDT)
Michael Hwang <nomex45@yahoo.com> 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).
 )
+vindex(ZLE_REMOVE_SUFFIX_CHARS)
+item(tt(ZLE_REMOVE_SUFFIX_CHARS))(
+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.
+)
 enditem()
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 *


  reply	other threads:[~2009-04-22 16:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-21  5:11 Michael Hwang
2009-04-21  7:03 ` Bart Schaefer
2009-04-22 15:28   ` Michael Hwang
2009-04-22 16:04     ` Peter Stephenson [this message]
2009-04-22 17:07       ` Greg Klanderman
2009-04-23  9:31         ` Peter Stephenson
2009-04-23 10:43           ` Peter Stephenson

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=20090422170420.6c5e5d36@news01 \
    --to=pws@csr.com \
    --cc=zsh-workers@sunsite.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).