From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: PATCH: Re: Getting "parse error" from _path_files
Date: Tue, 13 Jun 2000 13:43:08 +0200 (MET DST) [thread overview]
Message-ID: <200006131143.NAA30847@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: "Bart Schaefer"'s message of Mon, 5 Jun 2000 04:48:00 +0000
Bart Schaefer wrote:
> ...
>
> There are actually two things at issue here. The second is that I'd rather
> that completion didn't happen when I'm doing cut'n'paste. I tried putting:
>
> (( PENDING )) && compstate[insert]=tab
>
> near the top of _main_complete, right after curcontext is set up, and that
> seems to help a bit, but I'm rather leery of that solution. It does need
> to use PENDING somehow, though.
How about this. Allow `insert-tab' to contain the string
`pending[=num]' which makes completion insert a TAB (or, actually,
whatever character was typed to start completion) if it is given. If
there is a `=num', it will insert it only if there are at least that
many unread characters.
Bye
Sven
Index: Completion/Core/_main_complete
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Core/_main_complete,v
retrieving revision 1.27
diff -u -r1.27 _main_complete
--- Completion/Core/_main_complete 2000/05/31 09:56:12 1.27
+++ Completion/Core/_main_complete 2000/06/13 11:41:35
@@ -23,7 +23,7 @@
# Failed returns from this code are not real errors
setopt localtraps noerrexit ; trap - ZERR
-local func funcs ret=1 tmp _compskip format nm call \
+local func funcs ret=1 tmp _compskip format nm call match \
_completers _completer _completer_num curtag _comp_force_list \
_matchers _matcher _matcher_num _comp_tags _comp_mesg \
context state line opt_args val_args curcontext="$curcontext" \
@@ -38,8 +38,18 @@
[[ -z "$curcontext" ]] && curcontext=:::
-if [[ "$compstate[insert]" = tab* && "$WIDGET" != *list* ]]; then
- { zstyle -T ":completion:${curcontext}:" insert-tab &&
+zstyle -s ":completion:${curcontext}:" insert-tab tmp || tmp=no
+
+if [[ "$tmp" = *pending(|[[:blank:]]*) ||
+ ( "$tmp" = *pending=(#b)([0-9]##)(|[[:blank:]]*) &&
+ PENDING -ge $match[1] ) ]]; then
+ compstate[insert]=tab
+
+ return 0
+fi
+
+if [[ "$compstate[insert]" = tab* ]]; then
+ { "$tmp" = (|[[:blank:]]*)(yes|true|on|1)(|[[:blank:]]*) &&
{ [[ "$curcontext" != :* || -z "$compstate[vared]" ]] ||
zstyle -t ":completion:vared${curcontext}:" insert-tab } } && return 0
Index: Doc/Zsh/compsys.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/compsys.yo,v
retrieving revision 1.61
diff -u -r1.61 compsys.yo
--- Doc/Zsh/compsys.yo 2000/06/13 11:26:08 1.61
+++ Doc/Zsh/compsys.yo 2000/06/13 11:41:37
@@ -1278,6 +1278,16 @@
of performing completion when there is no non-blank character to the left
of the cursor. If set to `false', completion will be done even there.
+The value may also contain the substrings `tt(pending)' or
+`tt(pending=)var(val)' to make the character typed to start completion
+be inserted instead of completion being tried when there is input
+pending which has not yet been processed by the shell. If a var(val)
+is given, completion will not be done if there are at least that many
+characters of unprocessed input. This is often useful to have set when
+pasting characters into a terminal. Note however, that it relies on
+the tt($PENDING) special parameter from the tt(zle) module being set
+properly which is not guaranteed on all platforms.
+
The default value of this style is `true' unless when completing
inside the tt(vared) builtin command, where it defaults to `false'.
)
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
next reply other threads:[~2000-06-13 12:46 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-06-13 11:43 Sven Wischnowsky [this message]
-- strict thread matches above, loose matches on Subject: below --
2000-06-06 8:33 Sven Wischnowsky
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=200006131143.NAA30847@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).