help / color / mirror / code / Atom feed
From: Oliver Kiddle <opk@zsh.org>
To: Zsh workers <zsh-workers@zsh.org>
Subject: PATCH: fix for control characters and singlelinezle
Date: Mon, 09 Jan 2023 23:04:06 +0100	[thread overview]
Message-ID: <52254-1673301846.490897@ja-O.BWAu.6IyE> (raw)

I noticed some weird effects with control characters and the
singlelinezle option. Every control character would appear as ^@ and
change to ^? once the next character is typed (with the next character
not being displayed). Also the cursor is getting positioned over the
last character position of special characters that are rendered as
multiple characters. I guess it's not an option that gets a lot of use.


diff --git a/Src/Zle/zle_refresh.c b/Src/Zle/zle_refresh.c
index 6d75b0fda..daa43336e 100644
--- a/Src/Zle/zle_refresh.c
+++ b/Src/Zle/zle_refresh.c
@@ -2429,6 +2429,8 @@ singlerefresh(ZLE_STRING_T tmpline, int tmpll, int tmpcs)
 	all_attr = mixattrs(special_attr, base_attr);
+	if (t0 == tmpcs)
+	    nvcs = vp - vbuf;
 	if (tmpline[t0] == ZWC('\t')) {
 	    for (*vp++ = zr_sp; (vp - vbuf) & 7; )
 		*vp++ = zr_sp;
@@ -2471,7 +2473,7 @@ singlerefresh(ZLE_STRING_T tmpline, int tmpll, int tmpcs)
 		   && (unsigned)tmpline[t0] <= 0xffU
 		   ) {
-	    ZLE_INT_T t = tmpline[++t0];
+	    ZLE_INT_T t = tmpline[t0];
 	    vp->chr = ZWC('^');
 	    vp->atr = all_attr;
@@ -2508,8 +2510,6 @@ singlerefresh(ZLE_STRING_T tmpline, int tmpll, int tmpcs)
-	if (t0 == tmpcs)
-	    nvcs = vp - vbuf - 1;
     if (t0 == tmpcs)
 	nvcs = vp - vbuf;

                 reply	other threads:[~2023-01-09 22:04 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52254-1673301846.490897@ja-O.BWAu.6IyE \
    --to=opk@zsh.org \
    --cc=zsh-workers@zsh.org \


* 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


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).