From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: zsh-workers@zsh.org
Subject: [PATCH] zle: Call zle-line-pre-redraw when popping from bufstack.
Date: Sun, 25 Sep 2016 13:25:05 +0000 [thread overview]
Message-ID: <1474809905-12861-1-git-send-email-danielsh@fujitsu.shahaf.local2> (raw)
---
I'd appreciate another pair of eyes; it looks correct but I'm not very
familiar with this part of the code.
Originally reported as <https://github.com/zsh-users/zsh-syntax-highlighting/issues/40>.
Thanks,
Daniel
Src/Zle/zle_main.c | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c
index 9a83d41..89a545b 100644
--- a/Src/Zle/zle_main.c
+++ b/Src/Zle/zle_main.c
@@ -1162,7 +1162,16 @@ zlecore(void)
popheap();
}
-/* Read a line. It is returned metafied. */
+/* Read a line. It is returned metafied.
+ *
+ * Parmaeters:
+ * - lp: left prompt, e.g., $PS1
+ * - rp: right prompt, e.g., $RPS1
+ * - flags: ZLRF_* flags (I think), see zlereadflags
+ * - context: ZLCON_* flags (I think), see zlecontext
+ * - init: "zle-line-init"
+ * - finish: "zle-line-finish"
+ */
/**/
char *
@@ -1171,6 +1180,7 @@ zleread(char **lp, char **rp, int flags, int context, char *init, char *finish)
char *s, **bracket;
int old_errno = errno;
int tmout = getiparam("TMOUT");
+ int redraw_required = 0;
#if defined(HAVE_POLL) || defined(HAVE_SELECT)
/* may not be set, but that's OK since getiparam() returns 0 == off */
@@ -1242,6 +1252,7 @@ zleread(char **lp, char **rp, int flags, int context, char *init, char *finish)
initundo();
fixsuffix();
if ((s = getlinknode(bufstack))) {
+ redraw_required = 1;
setline(s, ZSL_TOEND);
zsfree(s);
if (stackcs != -1) {
@@ -1293,6 +1304,12 @@ zleread(char **lp, char **rp, int flags, int context, char *init, char *finish)
prefixflag = 0;
region_active = 0;
+ if (redraw_required) {
+ /* If we popped a command from bufstack, syntax highlight it, now
+ * that zle is active. */
+ redrawhook();
+ }
+
zrefresh();
unqueue_signals(); /* Should now be safe to acknowledge SIGWINCH */
next reply other threads:[~2016-09-25 13:26 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-25 13:25 Daniel Shahaf [this message]
2016-09-25 14:00 ` Mikael Magnusson
2016-09-26 9:59 ` PATCH: Call the pre-redraw hook if there is text in the buffer on init Mikael Magnusson
2016-09-30 4:54 ` 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=1474809905-12861-1-git-send-email-danielsh@fujitsu.shahaf.local2 \
--to=d.s@daniel.shahaf.name \
--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).