* Incorrect cursor position when ZLE_RPROMPT_INDENT=0 (with a fix)
@ 2019-05-19 15:38 Roman Perepelitsa
2019-05-19 15:41 ` Roman Perepelitsa
2019-05-19 17:04 ` Bart Schaefer
0 siblings, 2 replies; 28+ messages in thread
From: Roman Perepelitsa @ 2019-05-19 15:38 UTC (permalink / raw)
To: zsh-workers
[-- Attachment #1: Type: text/plain, Size: 3170 bytes --]
To reproduce:
ZLE_RPROMPT_INDENT=0
PROMPT=12
RPROMPT=3
Expected behavior: The cursor is positioned after ‘2’.
Actual behavior: The cursor is positioned on ‘2’.
The following patch fixes this issue.
diff --git a/Src/Zle/zle_refresh.c b/Src/Zle/zle_refresh.c
index 1f293845f..9c650d3ae 100644--- a/Src/Zle/zle_refresh.c+++
b/Src/Zle/zle_refresh.c
@@ -1678,7 +1678,7 @@ zrefresh(void)
moveto(0, winw - rprompt_off - rpromptw);
zputs(rpromptbuf, shout);- vcs = winw - rprompt_off;+
vcs = winw - (rprompt_off ? rprompt_off : 1);
/* reset character attributes to that set by the main prompt */
txtchange = pmpt_attr;
/*
@@ -2159,7 +2159,7 @@ moveto(int ln, int cl)
const REFRESH_ELEMENT *rep;
if (vcs == winw) {- if (rprompt_indent == 0 && tccan(TCLEFT))
{+ if (0) {
tc_leftcurs(1);
vcs--;
} else {
There is now an if-else with 0 as the condition. I’ve posted the diff this
way to make it clearer what I’d actually changed. The if-else can, of
course, be replaced with a single block of code (what used to be under else),
which produces a larger diff due to indentation changes. ZSH source code
uses a mixture of tabs and spaces, so I’m not sure if I deindented it right.
diff --git a/Src/Zle/zle_refresh.c b/Src/Zle/zle_refresh.c
index 1f293845f..85f9d9305 100644--- a/Src/Zle/zle_refresh.c+++
b/Src/Zle/zle_refresh.c
@@ -1678,7 +1678,7 @@ zrefresh(void)
moveto(0, winw - rprompt_off - rpromptw);
zputs(rpromptbuf, shout);- vcs = winw - rprompt_off;+
vcs = winw - (rprompt_off ? rprompt_off : 1);
/* reset character attributes to that set by the main prompt */
txtchange = pmpt_attr;
/*
@@ -2159,25 +2159,20 @@ moveto(int ln, int cl)
const REFRESH_ELEMENT *rep;
if (vcs == winw) {- if (rprompt_indent == 0 && tccan(TCLEFT))
{- tc_leftcurs(1);- vcs--;- } else {- vln++, vcs =
0;- if (!hasam) {- zputc(&zr_cr);-
zputc(&zr_nl);- } else {- if ((vln < nlnct) && nbuf[vln]
&& nbuf[vln]->chr)- rep = nbuf[vln];- else-
rep = &zr_sp;- zputc(rep);- zputc(&zr_cr);- if
((vln < olnct) && obuf[vln] && obuf[vln]->chr)- *obuf[vln]
= *rep;- }- }+ vln++, vcs = 0;+ if (!hasam) {+
zputc(&zr_cr);+ zputc(&zr_nl);+ } else {+ if ((vln < nlnct)
&& nbuf[vln] && nbuf[vln]->chr)+ rep = nbuf[vln];+ else+
rep = &zr_sp;+ zputc(rep);+ zputc(&zr_cr);+ if ((vln <
olnct) && obuf[vln] && obuf[vln]->chr)+ *obuf[vln] = *rep;+
}
}
if (ln == vln && cl == vcs)
The same thing on github:
https://github.com/zsh-users/zsh/compare/master…romkatv:rprompt-indent
<https://github.com/zsh-users/zsh/compare/master...romkatv:rprompt-indent>.
I’ve verified that it works correctly with ZLE_RPROMPT_INDENT={0,1,2} in
GNOME Terminal on Ubuntu 18.04. The cursor gets positioned in the right
place and there is no weird behavior in completion menu or other multi-line
ZLE situations.
Roman.
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Incorrect cursor position when ZLE_RPROMPT_INDENT=0 (with a fix)
2019-05-19 15:38 Incorrect cursor position when ZLE_RPROMPT_INDENT=0 (with a fix) Roman Perepelitsa
@ 2019-05-19 15:41 ` Roman Perepelitsa
2019-05-19 17:04 ` Bart Schaefer
1 sibling, 0 replies; 28+ messages in thread
From: Roman Perepelitsa @ 2019-05-19 15:41 UTC (permalink / raw)
To: zsh-workers
[-- Attachment #1: Type: text/plain, Size: 3540 bytes --]
In case the patch got mangled by the mail server, please see
https://github.com/zsh-users/zsh/compare/master...romkatv:rprompt-indent.
Roman.
On Sun, May 19, 2019 at 5:38 PM Roman Perepelitsa <
roman.perepelitsa@gmail.com> wrote:
> To reproduce:
>
> ZLE_RPROMPT_INDENT=0
> PROMPT=12
> RPROMPT=3
>
> Expected behavior: The cursor is positioned after ‘2’.
> Actual behavior: The cursor is positioned on ‘2’.
>
> The following patch fixes this issue.
>
> diff --git a/Src/Zle/zle_refresh.c b/Src/Zle/zle_refresh.c
> index 1f293845f..9c650d3ae 100644--- a/Src/Zle/zle_refresh.c+++ b/Src/Zle/zle_refresh.c
> @@ -1678,7 +1678,7 @@ zrefresh(void)
>
> moveto(0, winw - rprompt_off - rpromptw);
> zputs(rpromptbuf, shout);- vcs = winw - rprompt_off;+ vcs = winw - (rprompt_off ? rprompt_off : 1);
> /* reset character attributes to that set by the main prompt */
> txtchange = pmpt_attr;
> /*
> @@ -2159,7 +2159,7 @@ moveto(int ln, int cl)
> const REFRESH_ELEMENT *rep;
>
> if (vcs == winw) {- if (rprompt_indent == 0 && tccan(TCLEFT)) {+ if (0) {
> tc_leftcurs(1);
> vcs--;
> } else {
>
> There is now an if-else with 0 as the condition. I’ve posted the diff
> this way to make it clearer what I’d actually changed. The if-else can,
> of course, be replaced with a single block of code (what used to be under
> else), which produces a larger diff due to indentation changes. ZSH
> source code uses a mixture of tabs and spaces, so I’m not sure if I
> deindented it right.
>
> diff --git a/Src/Zle/zle_refresh.c b/Src/Zle/zle_refresh.c
> index 1f293845f..85f9d9305 100644--- a/Src/Zle/zle_refresh.c+++ b/Src/Zle/zle_refresh.c
> @@ -1678,7 +1678,7 @@ zrefresh(void)
>
> moveto(0, winw - rprompt_off - rpromptw);
> zputs(rpromptbuf, shout);- vcs = winw - rprompt_off;+ vcs = winw - (rprompt_off ? rprompt_off : 1);
> /* reset character attributes to that set by the main prompt */
> txtchange = pmpt_attr;
> /*
> @@ -2159,25 +2159,20 @@ moveto(int ln, int cl)
> const REFRESH_ELEMENT *rep;
>
> if (vcs == winw) {- if (rprompt_indent == 0 && tccan(TCLEFT)) {- tc_leftcurs(1);- vcs--;- } else {- vln++, vcs = 0;- if (!hasam) {- zputc(&zr_cr);- zputc(&zr_nl);- } else {- if ((vln < nlnct) && nbuf[vln] && nbuf[vln]->chr)- rep = nbuf[vln];- else- rep = &zr_sp;- zputc(rep);- zputc(&zr_cr);- if ((vln < olnct) && obuf[vln] && obuf[vln]->chr)- *obuf[vln] = *rep;- }- }+ vln++, vcs = 0;+ if (!hasam) {+ zputc(&zr_cr);+ zputc(&zr_nl);+ } else {+ if ((vln < nlnct) && nbuf[vln] && nbuf[vln]->chr)+ rep = nbuf[vln];+ else+ rep = &zr_sp;+ zputc(rep);+ zputc(&zr_cr);+ if ((vln < olnct) && obuf[vln] && obuf[vln]->chr)+ *obuf[vln] = *rep;+ }
> }
>
> if (ln == vln && cl == vcs)
>
> The same thing on github:
> https://github.com/zsh-users/zsh/compare/master…romkatv:rprompt-indent
> <https://github.com/zsh-users/zsh/compare/master...romkatv:rprompt-indent>
> .
>
> I’ve verified that it works correctly with ZLE_RPROMPT_INDENT={0,1,2} in
> GNOME Terminal on Ubuntu 18.04. The cursor gets positioned in the right
> place and there is no weird behavior in completion menu or other multi-line
> ZLE situations.
>
> Roman.
>
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Incorrect cursor position when ZLE_RPROMPT_INDENT=0 (with a fix)
2019-05-19 15:38 Incorrect cursor position when ZLE_RPROMPT_INDENT=0 (with a fix) Roman Perepelitsa
2019-05-19 15:41 ` Roman Perepelitsa
@ 2019-05-19 17:04 ` Bart Schaefer
2019-05-19 17:34 ` Roman Perepelitsa
1 sibling, 1 reply; 28+ messages in thread
From: Bart Schaefer @ 2019-05-19 17:04 UTC (permalink / raw)
To: Roman Perepelitsa; +Cc: zsh-workers
We constantly go around on this. If we un-break it for one terminal
type it breaks for another. It's an acknowledged problem that in some
cases you can't set ZLE_RPROMPT_INDENT=0, that's why the variable
exists in the first place; if it always worked to set it to zero we'd
remove it.
All your patch does is remove a test for the value of that variable.
A more correct change would be to add to the test condition a check
for whether placing a character in the rightmost column (or the
rightmost/bottom-most position) causes the terminal to auto-wrap (or
not) the cursor onto the next line. Unfortunately there's no way to
reliably determine that (e.g., there's no termcap/terminfo value that
reports it consistently).
What $ZSH_PATCHLEVEL were you testing against? There was a related
change committed only a month ago, and there has not been a release in
the meantime.
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Incorrect cursor position when ZLE_RPROMPT_INDENT=0 (with a fix)
2019-05-19 17:04 ` Bart Schaefer
@ 2019-05-19 17:34 ` Roman Perepelitsa
2019-05-19 18:09 ` Roman Perepelitsa
0 siblings, 1 reply; 28+ messages in thread
From: Roman Perepelitsa @ 2019-05-19 17:34 UTC (permalink / raw)
To: Bart Schaefer; +Cc: zsh-workers
[-- Attachment #1: Type: text/plain, Size: 1931 bytes --]
On Sun, May 19, 2019 at 7:05 PM Bart Schaefer <schaefer@brasslantern.com>
wrote:
> We constantly go around on this. If we un-break it for one terminal
> type it breaks for another. It's an acknowledged problem that in some
> cases you can't set ZLE_RPROMPT_INDENT=0, that's why the variable
> exists in the first place; if it always worked to set it to zero we'd
> remove it.
>
> All your patch does is remove a test for the value of that variable.
> A more correct change would be to add to the test condition a check
> for whether placing a character in the rightmost column (or the
> rightmost/bottom-most position) causes the terminal to auto-wrap (or
> not) the cursor onto the next line.
At first I thought that on my terminal (GNOME Terminal) there is
auto-wrapping when RPROMPT is written at the very right edge. It can be
seen when I set RPROMPT='%K{red}X' and ZLE_RPROMPT_INDENT=0, which results
in an extra line below the prompt with a red cell on the left. Then, after
some debugging, I realized that it's not my terminal that causes
auto-wrapping but ZSH. zputs(rpromptbuf, shout) at zle_refresh.c:1680
doesn't create that new line even when ZLE_RPROMPT_INDENT=0. The following
ZSH code does. That's why my patch doesn't just disable a condition but
also adjusts vcs after zputs(rpromptbuf, shout).
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.
What $ZSH_PATCHLEVEL were you testing against? There was a related
> change committed only a month ago, and there has not been a release in
> the meantime.
>
echo $ZSH_PATCHLEVEL
zsh-5.7.1-77-gfae7c85
My fork is currently 1 commit ahead of zsh-users/zsh on github.
Roman.
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Incorrect cursor position when ZLE_RPROMPT_INDENT=0 (with a fix)
2019-05-19 17:34 ` Roman Perepelitsa
@ 2019-05-19 18:09 ` Roman Perepelitsa
2019-05-19 18:51 ` Roman Perepelitsa
0 siblings, 1 reply; 28+ messages in thread
From: Roman Perepelitsa @ 2019-05-19 18:09 UTC (permalink / raw)
To: Bart Schaefer; +Cc: zsh-workers
[-- Attachment #1: Type: text/plain, Size: 1374 bytes --]
On Sun, May 19, 2019 at 7:34 PM Roman Perepelitsa <
roman.perepelitsa@gmail.com> 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:
https://github.com/zsh-users/zsh/compare/master...romkatv:rprompt-indent2.
If anyone can point me to a terminal on which this doesn't work, I'll be
happy to debug and educate myself.
Roman.
>
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Incorrect cursor position when ZLE_RPROMPT_INDENT=0 (with a fix)
2019-05-19 18:09 ` Roman Perepelitsa
@ 2019-05-19 18:51 ` Roman Perepelitsa
2019-05-19 20:12 ` Bart Schaefer
0 siblings, 1 reply; 28+ messages in thread
From: Roman Perepelitsa @ 2019-05-19 18:51 UTC (permalink / raw)
To: Bart Schaefer; +Cc: zsh-workers
[-- Attachment #1: Type: text/plain, Size: 1725 bytes --]
I've tested my patch on two more terminals: Dumb Linux terminal
(TERM=linux) and Command Prompt with WSL. On both of them ZSH misbehaves
without my patch and works correctly with it.
Roman.
On Sun, May 19, 2019 at 8:09 PM Roman Perepelitsa <
roman.perepelitsa@gmail.com> wrote:
> On Sun, May 19, 2019 at 7:34 PM Roman Perepelitsa <
> roman.perepelitsa@gmail.com> 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:
> https://github.com/zsh-users/zsh/compare/master...romkatv:rprompt-indent2.
>
> If anyone can point me to a terminal on which this doesn't work, I'll be
> happy to debug and educate myself.
>
> Roman.
>
>>
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Incorrect cursor position when ZLE_RPROMPT_INDENT=0 (with a fix)
2019-05-19 18:51 ` Roman Perepelitsa
@ 2019-05-19 20:12 ` Bart Schaefer
2019-05-19 21:07 ` Roman Perepelitsa
0 siblings, 1 reply; 28+ messages in thread
From: Bart Schaefer @ 2019-05-19 20:12 UTC (permalink / raw)
To: Roman Perepelitsa; +Cc: zsh-workers
On Sun, May 19, 2019 at 11:51 AM Roman Perepelitsa
<roman.perepelitsa@gmail.com> wrote:
>
> I've tested my patch on two more terminals: Dumb Linux terminal (TERM=linux) and Command Prompt with WSL. On both of them ZSH misbehaves without my patch and works correctly with it.
This is promising and the patch looks plausible, but I must ask: Have
you tested the case where the rprompt is printed on the final line of
the visible screen?
There are several terminals where auto-margin behaves differently when
characters (especially carriage returns) are printed at or to the
right of the margin in the bottom row vs. rows above that.
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Incorrect cursor position when ZLE_RPROMPT_INDENT=0 (with a fix)
2019-05-19 20:12 ` Bart Schaefer
@ 2019-05-19 21:07 ` Roman Perepelitsa
2019-05-20 8:21 ` Yannic Schröder
0 siblings, 1 reply; 28+ messages in thread
From: Roman Perepelitsa @ 2019-05-19 21:07 UTC (permalink / raw)
To: Bart Schaefer; +Cc: zsh-workers
[-- Attachment #1: Type: text/plain, Size: 1149 bytes --]
On Sun, May 19, 2019 at 10:12 PM Bart Schaefer <schaefer@brasslantern.com>
wrote:
> On Sun, May 19, 2019 at 11:51 AM Roman Perepelitsa
> <roman.perepelitsa@gmail.com> wrote:
> >
> > I've tested my patch on two more terminals: Dumb Linux terminal
> (TERM=linux) and Command Prompt with WSL. On both of them ZSH misbehaves
> without my patch and works correctly with it.
>
> This is promising and the patch looks plausible, but I must ask: Have
> you tested the case where the rprompt is printed on the final line of
> the visible screen?
>
I went back and retested. Yes, it works correctly when rprompt is printed
on the final line of the visible screen.
I've now tested on two more terminals: KDE Konsole and Alacritty. This is
the full list of terminals I've tested so far, all reasonably new versions:
- GNOME Terminal.
- MacOS Terminal.
- Dumb Linux Terminal.
- Windows Command Prompt (WSL).
- Konsole.
- Alacritty.
On all of them when RPROMPT is non-empty and ZLE_RPROMPT_INDENT=0 ZSH
behaves incorrectly without the patch, and correctly with the patch (
https://github.com/zsh-users/zsh/compare/master...romkatv:rprompt-indent2).
Roman.
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Incorrect cursor position when ZLE_RPROMPT_INDENT=0 (with a fix)
2019-05-19 21:07 ` Roman Perepelitsa
@ 2019-05-20 8:21 ` Yannic Schröder
2019-05-20 8:36 ` Roman Perepelitsa
0 siblings, 1 reply; 28+ messages in thread
From: Yannic Schröder @ 2019-05-20 8:21 UTC (permalink / raw)
To: zsh-workers
On 19.05.19 23:07, Roman Perepelitsa wrote:
> I've now tested on two more terminals: KDE Konsole and Alacritty. This is
> the full list of terminals I've tested so far, all reasonably new versions:
>
> - GNOME Terminal.
> - MacOS Terminal.
> - Dumb Linux Terminal.
> - Windows Command Prompt (WSL).
> - Konsole.
> - Alacritty.
Maybe add some of the common alternative Linux terminals to the test?
Like Terminator and Tilix?
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Incorrect cursor position when ZLE_RPROMPT_INDENT=0 (with a fix)
2019-05-20 8:21 ` Yannic Schröder
@ 2019-05-20 8:36 ` Roman Perepelitsa
2019-05-20 10:21 ` Charles Blake
0 siblings, 1 reply; 28+ messages in thread
From: Roman Perepelitsa @ 2019-05-20 8:36 UTC (permalink / raw)
To: Yannic Schröder; +Cc: zsh-workers
[-- Attachment #1: Type: text/plain, Size: 1004 bytes --]
On Mon, May 20, 2019 at 10:22 AM Yannic Schröder <schroeder@ibr.cs.tu-bs.de>
wrote:
> Maybe add some of the common alternative Linux terminals to the test?
> Like Terminator and Tilix?
>
Thanks for the advice. Just tested these. I also added XTerm to the list.
They all behave as the other terminals I've tested yesterday.
So far I've tested 9 terminals on 3 operating systems. They all behave
identically without my patch (the cursor position is off by one) and with
my patch (the cursor position is correct).
I suppose there should be a terminal on which the unpatched ZSH works
correctly but so far I haven't found it. I'd really like to. If anyone here
is using a terminal for which the following test works, please give a
holler.
1. Type `zsh -df`.
2. Type `ZLE_RPROMPT_INDENT=0 PROMPT=12 RPROMPT=3`.
3. Observe the position of the cursor. The correct position is after '2'.
All terminals I've tested put cursor on '2' -- one position to the left of
correct.
Roman.
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Incorrect cursor position when ZLE_RPROMPT_INDENT=0 (with a fix)
2019-05-20 8:36 ` Roman Perepelitsa
@ 2019-05-20 10:21 ` Charles Blake
2019-05-20 10:46 ` Roman Perepelitsa
0 siblings, 1 reply; 28+ messages in thread
From: Charles Blake @ 2019-05-20 10:21 UTC (permalink / raw)
To: zsh-workers
[-- Attachment #1: Type: text/plain, Size: 452 bytes --]
For me XTerm (vsn 337 on Gentoo), I got the unpatched zsh -df show "after
2" which I take it differs from your results. I also got rxvt-unicode-9.22
to have the unpatched zsh -df put the curser just after the 2. OTOH,
trying "st" (simple term from sucksless), I got the incorrect position "on
top of" the 2. You may also want to check the terminal emulator in PuTTY.
HP-UX and AIX terminals were always "odd", but those are harder to get
access to.
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Incorrect cursor position when ZLE_RPROMPT_INDENT=0 (with a fix)
2019-05-20 10:21 ` Charles Blake
@ 2019-05-20 10:46 ` Roman Perepelitsa
2019-05-20 11:06 ` Daniel Shahaf
` (2 more replies)
0 siblings, 3 replies; 28+ messages in thread
From: Roman Perepelitsa @ 2019-05-20 10:46 UTC (permalink / raw)
To: Charles Blake; +Cc: zsh-workers
[-- Attachment #1: Type: text/plain, Size: 1447 bytes --]
On Mon, May 20, 2019 at 12:22 PM Charles Blake <charlechaud@gmail.com>
wrote:
> For me XTerm (vsn 337 on Gentoo), I got the unpatched zsh -df show "after
> 2" which I take it differs from your results.
Thanks for the data point. Originally I've tried it on XTerm 330. I've now
also tested it on XTerm 345 -- the latest release. It gives the same
results as all other terminals I'd tested. I wasn't able to find the
sources for XTerm 337. Do you know where I can obtain them?
However, it's not likely that the same version of ZSH works on XTerm 330
and 345 but breaks on 337. A more plausible explanation is that there is
something else in our setups that causes the difference in terminal
behavior. Perhaps ZSH? I've tested with ZSH 5.4.2 that comes with Ubuntu
18.04 and with the latest version of the code that I pulled from
https://github.com/zsh-users/zsh (commit
fae7c853319798e170a0bcf1b3098b1a07447c70). Which version of ZSH are you
using?
Also, is it feasible for you to try my patch with the same terminal that
exhibits correct behavior without patching?
I also got rxvt-unicode-9.22
> to have the unpatched zsh -df put the curser just after the 2. OTOH,
> trying "st" (simple term from sucksless), I got the incorrect position "on
> top of" the 2. You may also want to check the terminal emulator in PuTTY.
> HP-UX and AIX terminals were always "odd", but those are harder to get
> access to.
Thanks, I'll try PuTTY.
Roman.
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Incorrect cursor position when ZLE_RPROMPT_INDENT=0 (with a fix)
2019-05-20 10:46 ` Roman Perepelitsa
@ 2019-05-20 11:06 ` Daniel Shahaf
2019-05-20 11:07 ` Charles Blake
2019-05-20 12:41 ` Charles Blake
2 siblings, 0 replies; 28+ messages in thread
From: Daniel Shahaf @ 2019-05-20 11:06 UTC (permalink / raw)
To: Roman Perepelitsa; +Cc: zsh-workers
Roman Perepelitsa wrote on Mon, 20 May 2019 10:48 +00:00:
> Thanks, I'll try PuTTY.
I'm not following the ZLE_RPROMPT_INDENT changes too closely, but just
wanted to say: thanks for taking the time to try all these terminals!
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Incorrect cursor position when ZLE_RPROMPT_INDENT=0 (with a fix)
2019-05-20 10:46 ` Roman Perepelitsa
2019-05-20 11:06 ` Daniel Shahaf
@ 2019-05-20 11:07 ` Charles Blake
2019-05-20 11:11 ` Peter Stephenson
2019-05-20 11:32 ` Roman Perepelitsa
2019-05-20 12:41 ` Charles Blake
2 siblings, 2 replies; 28+ messages in thread
From: Charles Blake @ 2019-05-20 11:07 UTC (permalink / raw)
To: zsh-workers
[-- Attachment #1: Type: text/plain, Size: 577 bytes --]
xterm sources:
ftp://ftp.invisible-island.net/xterm
I agreed that it's more likely to be something else than the version.
On my Linux virtual terminal, I get your observed incorrect at-2 unpatched
behavior with zsh -df, but with just zsh I get the correct (past 2)
behavior even without the patch.
zsh version is the 5.7.1 release. I can try your patch later today.
You should definitely check something rxvt-like as there are several
terminals derived from rxvt besides rxvt-unicode (aterm, eterm, mrxvt).
rxvt-unicode is at http://dist.schmorp.de/rxvt-unicode/Attic/
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Incorrect cursor position when ZLE_RPROMPT_INDENT=0 (with a fix)
2019-05-20 11:07 ` Charles Blake
@ 2019-05-20 11:11 ` Peter Stephenson
2019-05-20 11:32 ` Roman Perepelitsa
1 sibling, 0 replies; 28+ messages in thread
From: Peter Stephenson @ 2019-05-20 11:11 UTC (permalink / raw)
To: zsh-workers
On Mon, 2019-05-20 at 07:07 -0400, Charles Blake wrote:
> On my Linux virtual terminal, I get your observed incorrect at-2 unpatched
> behavior with zsh -df, but with just zsh I get the correct (past 2)
> behavior even without the patch.
Could it be picking up a different termcap / terminfo entry in the two cases?
pws
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Incorrect cursor position when ZLE_RPROMPT_INDENT=0 (with a fix)
2019-05-20 11:07 ` Charles Blake
2019-05-20 11:11 ` Peter Stephenson
@ 2019-05-20 11:32 ` Roman Perepelitsa
1 sibling, 0 replies; 28+ messages in thread
From: Roman Perepelitsa @ 2019-05-20 11:32 UTC (permalink / raw)
To: Charles Blake; +Cc: zsh-workers
[-- Attachment #1: Type: text/plain, Size: 1014 bytes --]
On Mon, May 20, 2019 at 1:08 PM Charles Blake <charlechaud@gmail.com> wrote:
> xterm sources:
> ftp://ftp.invisible-island.net/xterm
Thanks, I've tried it. XTerm 337 gives me the same results as the other two
versions I'd tried earlier.
You should definitely check something rxvt-like as there are several
> terminals derived from rxvt besides rxvt-unicode (aterm, eterm, mrxvt).
> rxvt-unicode is at http://dist.schmorp.de/rxvt-unicode/Attic/
Tested with rxvt-unicode on Ubuntu. It works correctly both with and
without my patch. I've also now tested on PuTTY, which also works correctly
both with and without my patch.
To summarize the tests performed by myself and other people on this thread.
Out of the 10+ terminals tested, there are terminals that without the patch
work correctly, work incorrectly, work correctly for some people and not
others, work correctly without `-df` and incorrectly with it. What's
encouraging is that all terminals tested so far work correctly with the
patch.
Roman.
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Incorrect cursor position when ZLE_RPROMPT_INDENT=0 (with a fix)
2019-05-20 10:46 ` Roman Perepelitsa
2019-05-20 11:06 ` Daniel Shahaf
2019-05-20 11:07 ` Charles Blake
@ 2019-05-20 12:41 ` Charles Blake
2019-05-20 13:16 ` Roman Perepelitsa
2 siblings, 1 reply; 28+ messages in thread
From: Charles Blake @ 2019-05-20 12:41 UTC (permalink / raw)
To: Roman Perepelitsa; +Cc: zsh-workers
[-- Attachment #1: Type: text/plain, Size: 1236 bytes --]
So, feel free to confirm yourself with xterm -rw or resource/default or
menu setting of reverseWrap, but with your patch and reverseWrap enabled, I
get incorrect behavior of a different sort. The cursor is not left
immediately after the 2, but there is an intervening blank space of exactly
1 character. Flipping the menu item on/off and hitting enter in the shell
to force a refresh toggles the misbehavior.
As to whether this should be a "supported configuration", well that is for
the larger audience to decide. Obviously for N config bools there are 2^N
configs and supporting them all is probably between impractical and
impossible. However, the xterm man page under the -rw option section says
this one is specifically encouraged:
This is very useful for editing long shell command lines
and is encouraged.
I'm not sure why reverseWrap is not on by default..You'd have to ask Tom
Dickey that, but I would guess it is to support some popular shell/usage
mode. Or maybe the feature and documentation are vestiges from some long
bygone era. I haven't looked into it much.
In better news, I also got things to work both with/without your patch in
emacs shell mode under X11 emacs as well as terminal mode emacs -nw.
^ permalink raw reply [flat|nested] 28+ messages in thread
end of thread, other threads:[~2019-05-28 14:27 UTC | newest]
Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-19 15:38 Incorrect cursor position when ZLE_RPROMPT_INDENT=0 (with a fix) Roman Perepelitsa
2019-05-19 15:41 ` Roman Perepelitsa
2019-05-19 17:04 ` Bart Schaefer
2019-05-19 17:34 ` Roman Perepelitsa
2019-05-19 18:09 ` Roman Perepelitsa
2019-05-19 18:51 ` Roman Perepelitsa
2019-05-19 20:12 ` Bart Schaefer
2019-05-19 21:07 ` Roman Perepelitsa
2019-05-20 8:21 ` Yannic Schröder
2019-05-20 8:36 ` Roman Perepelitsa
2019-05-20 10:21 ` Charles Blake
2019-05-20 10:46 ` Roman Perepelitsa
2019-05-20 11:06 ` Daniel Shahaf
2019-05-20 11:07 ` Charles Blake
2019-05-20 11:11 ` Peter Stephenson
2019-05-20 11:32 ` Roman Perepelitsa
2019-05-20 12:41 ` Charles Blake
2019-05-20 13:16 ` Roman Perepelitsa
[not found] ` <CAKiz1a-nOkAe42JoxFRgMJ+LXZ3fgMxqgwNZOW+2Y45oqzu8hA@mail.gmail.com>
2019-05-20 13:55 ` Roman Perepelitsa
2019-05-23 5:48 ` Roman Perepelitsa
2019-05-23 21:36 ` Daniel Shahaf
2019-05-23 22:52 ` Roman Perepelitsa
2019-05-24 12:18 ` Daniel Shahaf
2019-05-27 15:36 ` Roman Perepelitsa
2019-05-27 21:51 ` Peter Stephenson
2019-05-28 8:44 ` Peter Stephenson
2019-05-28 8:46 ` Roman Perepelitsa
2019-05-28 14:26 ` Bart Schaefer
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).