Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Incorrect cursor position when ZLE_RPROMPT_INDENT=0 (with a fix)

On Sun, May 19, 2019 at 7:34 PM Roman Perepelitsa <
roman.perepelitsa@xxxxxxxxx> wrote:

> Do I understand you correctly that prior to my patch ZSH
> handled ZLE_RPROMPT_INDENT=0 correctly on terminals that do auto-wrap after
> RPROMPT is written, but my patch broke them? If so, could point me to such
> a terminal? It would be very helpful. I realize that you've had this
> discussion a million times and I appreciate your patience.

Answered my own question. My patch adds an extra space on Mac Terminal.
I've now changed it slightly so that it works correctly on GNOME Terminal
and Mac Terminal. Here's the additional change I've made:

diff --git a/Src/Zle/zle_refresh.c b/Src/Zle/zle_refresh.c
index 1f293845f..85e55e0d4 100644
--- a/Src/Zle/zle_refresh.c
+++ b/Src/Zle/zle_refresh.c
@@ -1678,7 +1678,12 @@ zrefresh(void)

     moveto(0, winw - rprompt_off - rpromptw);
     zputs(rpromptbuf, shout);
-    vcs = winw - rprompt_off;
+    if (rprompt_off) {
+ vcs = winw - rprompt_off;
+    } else {
+ zputc(&zr_cr);
+ vcs = 0;
+    }
  /* reset character attributes to that set by the main prompt */
     txtchange = pmpt_attr;

You can see the whole diff here:

If anyone can point me to a terminal on which this doesn't work, I'll be
happy to debug and educate myself.



Messages sorted by: Reverse Date, Date, Thread, Author