zsh-workers
 help / color / mirror / code / Atom feed
From: Mikael Magnusson <mikachu@gmail.com>
To: zsh-workers@zsh.org
Subject: PATCH: Call the pre-redraw hook if there is text in the buffer on init
Date: Mon, 26 Sep 2016 11:59:34 +0200	[thread overview]
Message-ID: <20160926095934.27442-1-mikachu@gmail.com> (raw)
In-Reply-To: <1474809905-12861-1-git-send-email-danielsh@fujitsu.shahaf.local2>

[ As it turns out, the reason Daniel's patch didn't work for me was a
problem in my hook function, it just did an early return for optimization
based on how many times it was called since the last accept-line,
and that was off by one when popping the buffer apparently, I've just
removed that check now.

If you want to commit your comment at the top, there's a typo for Parmaeters. ]

Either way, I think this approach might be better. It will highlight
any text that may also have been added by the zle-line-init hook, in
addition to also highlighting popped text.

---
 Src/Zle/zle_main.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c
index 90e38042be..7a3cf249cf 100644
--- a/Src/Zle/zle_main.c
+++ b/Src/Zle/zle_main.c
@@ -1299,6 +1299,9 @@ zleread(char **lp, char **rp, int flags, int context, char *init, char *finish)
 
     zlecallhook(init, NULL);
 
+    if (zleline && *zleline)
+	redrawhook();
+
     if ((bracket = getaparam("zle_bracketed_paste")) && arrlen(bracket) == 2)
 	fputs(*bracket, shout);
 
-- 
2.8.2


  parent reply	other threads:[~2016-09-27  2:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-25 13:25 [PATCH] zle: Call zle-line-pre-redraw when popping from bufstack Daniel Shahaf
2016-09-25 14:00 ` Mikael Magnusson
2016-09-26  9:59 ` Mikael Magnusson [this message]
2016-09-30  4:54   ` PATCH: Call the pre-redraw hook if there is text in the buffer on init Bart Schaefer

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=20160926095934.27442-1-mikachu@gmail.com \
    --to=mikachu@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).