Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH/RFC] Fix compset -p/-s inconsistency and documentation
- X-seq: zsh-workers 44275
- From: dana <dana@xxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: [PATCH/RFC] Fix compset -p/-s inconsistency and documentation
- Date: Mon, 6 May 2019 18:11:37 -0500
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dana-is.20150623.gappssmtp.com; s=20150623; h=from:content-transfer-encoding:mime-version:subject:message-id:date :to; bh=oXRJQ3OBBnQYNXxOaFMNfBsALysON+n5B+GFdYaO6JU=; b=aFFtZza2CKRne4xtz5XYLwtW4WrGtcnrxeG7eK/ddxmutCIUJv/gN9s7/c6LRsurzS omU2xP4U0Ai/ANTgVSCHlKe0AInN930/uA0KDBduGTK6osHuwCYTIreISH7O8GP1cxJr jTNE/XsOuKF8gZ3vrvPRjDvNRviv75zGJxGorPR7DG3gW6FYR6PClwmwhR3rj3ivjbIW 4LQMvDrQAfoaHPJNxG7S11Y7OwnQIKKDJB015K5pAe/JsguUk3B5ZRR3zhpnIMDew+56 mn8Dgj9I3BIPIBcEVpTSs6Uo17norvUxFd+mLD556BJeDvkry7/lLEh2ob7vR8MAtbnr K4Ow==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
Whilst investigating workers/44272, a failure of the Y01 _tilde test led me to
discover that compset -p/-s doesn't work consistently with and without
multi-byte support:
% _foo() { compset -p 1; _message "${(qq)IPREFIX} ${(qq)PREFIX}" }
% compdef _foo foo
# Without multi-byte
% _comp_options+=( no_multibyte )
% foo .<TAB>
completing '' '.':
# With multi-byte
% _comp_options+=( multibyte )
% foo .<TAB>
completing '.' '':
I think this is the result of workers/41835.
Restoring the original behaviour seems simple (see patch), but i wanted to
confirm that it's the right thing, because the original behaviour actually
didn't (and the current behaviour still doesn't) match the documentation:
> If the contents of the PREFIX parameter *is longer than* number characters,
> the first number characters are removed from it and appended to the contents
> of the IPREFIX parameter.
Am i right to conclude that the documentation is wrong?
dana
diff --git a/Doc/Zsh/compwid.yo b/Doc/Zsh/compwid.yo
index 1cc94bf95..0f13b7fe0 100644
--- a/Doc/Zsh/compwid.yo
+++ b/Doc/Zsh/compwid.yo
@@ -728,8 +728,8 @@ The options are:
startitem()
item(tt(-p) var(number))(
-If the contents of the tt(PREFIX) parameter is longer than var(number)
-characters, the first var(number) characters are removed from it and
+If the value of the tt(PREFIX) parameter is at least var(number)
+characters long, the first var(number) characters are removed from it and
appended to the contents of the tt(IPREFIX) parameter.
)
item(tt(-P) [ var(number) ] var(pattern))(
diff --git a/Src/Zle/complete.c b/Src/Zle/complete.c
index 1dc2b01c2..0f3721b05 100644
--- a/Src/Zle/complete.c
+++ b/Src/Zle/complete.c
@@ -962,7 +962,7 @@ do_comp_vars(int test, int na, char *sa, int nb, char *sb, int mod)
}
} else
#endif
- if ((int)strlen(test == CVT_PRENUM ? compprefix : compsuffix) >= na)
+ if ((int)strlen(test == CVT_PRENUM ? compprefix : compsuffix) < na)
return 0;
if (test == CVT_PRENUM)
ignore_prefix(na);
Messages sorted by:
Reverse Date,
Date,
Thread,
Author