zsh-workers
 help / color / mirror / Atom feed
* [BUG] Zsh crashes when reverse-menu-complete is invoked during complist MENUSELECT without 'menu:' in $compstate[insert]
@ 2021-05-27  8:20 Marlon Richert
  2021-05-29 23:38 ` Oliver Kiddle
  0 siblings, 1 reply; 2+ messages in thread
From: Marlon Richert @ 2021-05-27  8:20 UTC (permalink / raw)
  To: Zsh hackers list

Given:
  * complist's MENUSELECT mode is active
  * $compstate[insert] does not start with 'menu:'
When:
  * The user activates reverse-menu-complete.
Then:
  * Zsh crashes.

Expected behavior:
  * Move to the previous completion in the menu.

Steps to reproduce:
% zmodload zsh/complist
% tst() { compadd bar baz; compstate[insert]=1 }
% zle -C tst menu-select tst
% bindkey '^I' tst
% bindkey -M menuselect '^[[Z' reverse-menu-complete
% ba^I^[[Z


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [BUG] Zsh crashes when reverse-menu-complete is invoked during complist MENUSELECT without 'menu:' in $compstate[insert]
  2021-05-27  8:20 [BUG] Zsh crashes when reverse-menu-complete is invoked during complist MENUSELECT without 'menu:' in $compstate[insert] Marlon Richert
@ 2021-05-29 23:38 ` Oliver Kiddle
  0 siblings, 0 replies; 2+ messages in thread
From: Oliver Kiddle @ 2021-05-29 23:38 UTC (permalink / raw)
  To: Zsh hackers list

On 27 May, Marlon Richert wrote:
> Given:
>   * complist's MENUSELECT mode is active
>   * $compstate[insert] does not start with 'menu:'
> When:
>   * The user activates reverse-menu-complete.
> Then:
>   * Zsh crashes.

It calls reversemenucomplete() which is a function that pre-dates menu
selection. The path down which it clears minfo didn't look appropriate
from within menu selection. But it doesn't crash for forward menu
completion. Taking the same code path as for forward completion but
with zmult negated appears to work fine and would seem logical enough.
But perhaps there's some aspect to reversemenucomplete() that would be
needed so it'd be good if this can get some further testing.

Oliver

diff --git a/Src/Zle/complist.c b/Src/Zle/complist.c
index 429c8159f..353cb3562 100644
--- a/Src/Zle/complist.c
+++ b/Src/Zle/complist.c
@@ -3277,9 +3277,8 @@ domenuselect(Hookdef dummy, Chdata dat)
 		   !strcmp(cmd->nam, "reverse-menu-complete")) {
             mode = 0;
 	    comprecursive = 1;
-	    unmetafy_line();
-	    reversemenucomplete(zlenoargs);
-	    metafy_line();
+	    zmult = -zmult;
+	    do_menucmp(0);
 	    mselect = (*(minfo.cur))->gnum;
 	    setwish = 1;
 	    mline = -1;


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-05-29 23:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-27  8:20 [BUG] Zsh crashes when reverse-menu-complete is invoked during complist MENUSELECT without 'menu:' in $compstate[insert] Marlon Richert
2021-05-29 23:38 ` Oliver Kiddle

zsh-workers

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.vuxu.org/zsh-workers

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 zsh-workers zsh-workers/ http://inbox.vuxu.org/zsh-workers \
		zsh-workers@zsh.org
	public-inbox-index zsh-workers

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.zsh.workers


code repositories for the project(s) associated with this inbox:

	https://git.vuxu.org/mirror/zsh/

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git