zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@zsh.org, Joe M <joe9mail@gmail.com>
Subject: Signal handlers and Re: Behaviour of zle list-choices
Date: Mon, 29 Feb 2016 10:47:24 -0800	[thread overview]
Message-ID: <160229104724.ZM4162@torch.brasslantern.com> (raw)
In-Reply-To: <20160228135652.GB2953@master>

On Feb 28,  7:56am, Joe M wrote:
}
} > type -a -f TRAPINT
} > TRAPINT () {
} >         ft_zle_state[minibuffer]=no
} >         ft-psvx-default
} >         zle reset-prompt 2> /dev/null
} >         return 127
} > }
} 
} Thanks for your suggestion. Removing the above TRAPINT fixed the
} issue that I am noticing.

OK, that helps.  The problem is with calling reset-prompt (really,
with calling redisplay, which is implied by reset-prompt) from the
signal handler.  The change to resetneeded and clearflag during the
handler causes ZLE to attempt twice to erase the list and move the
cursor back to the start of the prompt, which ends up moving too far
(though only erasing the list once, oddly enough).  It's as though
ZLE gets confused about the state of ALWAYS_LAST_PROMPT.

The following appears to fix it, though I only vaguely understand why.
Anyone care to shed some additional light before this gets committed?

diff --git a/Src/Zle/zle_refresh.c b/Src/Zle/zle_refresh.c
index 7e4f328..aca676a 100644
--- a/Src/Zle/zle_refresh.c
+++ b/Src/Zle/zle_refresh.c
@@ -2435,8 +2435,8 @@ redisplay(UNUSED(char **args))
     moveto(0, 0);
     zputc(&zr_cr);		/* extra care */
     tc_upcurs(lprompth - 1);
-    resetneeded = 1;
-    clearflag = 0;
+    resetneeded = !showinglist;
+    clearflag = showinglist;
     return 0;
 }
 


           reply	other threads:[~2016-02-29 18:47 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <20160228135652.GB2953@master>]

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=160229104724.ZM4162@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=joe9mail@gmail.com \
    --cc=zsh-workers@zsh.org \
    /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).