#978986 invisible cursor when on column 1 after wrapping from final column

Package:
libvte-2.91-0
Source:
vte2.91
Description:
Terminal emulator widget for GTK+ 3.0 - runtime files
Submitter:
Joey Hess
Date:
2023-04-28 20:03:02 UTC
Severity:
normal
#978986#5
Date:
2021-01-01 17:37:27 UTC
From:
To:
In both xfce-terminal and gnome-terminal, I see this behavior when
running cat and then typing enough characters to make the cursor reach
the final column and wrap back to column 1. When the cursor should be on
column 1, it's visible nowhere on the screen. Typing one more character
makes the cursor reappear, now on column 2.

This does not happen when doing the same kind of wrapping on the bash
prompt, but I imagine bash might be doing its own cursor positioning,
and so avoid the bug.

Attached short screencast demonstrates the problem, using xfce-terminal.

It seems worth noting that xterm also has a similar behavior, but not
the same. There the cursor remains at the far right column instead of
wrapping to column 1, then jumps to column 2! While odd, at least in
this case the user isn't left puzzled about why the cursor is not
visible at all. And konsole behaves as xterm.

#978986#10
Date:
2023-04-28 20:00:41 UTC
From:
To:
Hi,

In this scenario that you describe, when running `cat`, the cursor is _not_
in column 1.

xterm (and apparently konsole too) think of it as the cursor being in the
last column, with a special "about to wrap" (can't recall the exact term,
sorry) property set.

VTE seems to more think about it as the cursor being one more column
further to the right, in a column that's outside of the viewable area.

This is important for the correct behavior of apps that when you reach the
last cell of the bottom row, the terminal does not yet scroll. If the
cursor would move to column 1, it would just as well need to move to the
row just below the viewport, and again it would be invisible.

You can also confirm that the cursor haven't yet moved to the next row by
pressing backspace (which results in an utterly broken experience, sigh),
noting that reverse wraparound (e.g. backspace across linebreaks) is
disabled by default; or sending other escape sequences to move the cursor
left or move it to a certain column within its current row.

There's just no good solution for this problem, and indeed, VTE chose a
slightly different graphical representation than xterm, one that's not
necessarily better or worse.

You are absolutely correct here. Also, note that if you're typing the
command in the terminal's bottom row, it scrolls the contents upwards as
soon as you type a character into the last column. This way it can show the
cursor in the new empty last line, column 1. Bash is free to do it by using
its own cursor positioning. The default behavior of the terminal mustn't
scroll yet.

cheers,
egmont