After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 744819 - Incorrect cursor position after backspace at end of line with autowrap disabled -- breaks ncurses display
Incorrect cursor position after backspace at end of line with autowrap disabl...
Status: RESOLVED DUPLICATE of bug 731155
Product: vte
Classification: Core
Component: general
0.34.x
Other Linux
: Normal normal
: ---
Assigned To: VTE Maintainers
VTE Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-02-19 21:10 UTC by ulfalizer
Modified: 2015-03-03 14:34 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description ulfalizer 2015-02-19 21:10:24 UTC
(I'm using GNOME Terminal 3.6.2. I wasn't able to select that version.)

ncurses disables wraparound mode (DECAWM) when outputting a character in the right margin (last column) of the terminal. If the next character after that is a backspace, the cursor should move back to the second-to-last column, but gnome-terminal (or libvte) gets confused and keeps it in the last column. Further backspace characters do move the cursor, but at that point the cursor position is already off by one compared to what ncurses assumes, and so things break.

Here's a simple testcase (make ^H a real backspace and substitute some existing terminal for /dev/pts/25):

    (tput clear; tput rmam; echo -n "abcdefghijklmnopqrst^H ") > /dev/pts/25

("tput rmam" turns off autowrap mode (outputs "^[[?7l" for xterm).)

The output for gnome-terminal when the terminal width is 5 is

    "abcd "

(i.e., the cursor was not moved back before outputting the space.)

The output for for xterm when the terminal width is 5 is

    "abc e"

("e" might be an error too, but at least the cursor position is correct.)

/Ulfalizer
Comment 1 Egmont Koblinger 2015-02-20 00:20:42 UTC
You're using an ancient version of gnome-terminal/vte. There have been lots of fixes to the emulation; in particular, this bug has been fixed (you get "abc t" and the cursor over "t").

xterm is definitely buggy, the output depends on timing. The command above gives "abc e", while piping through slowcat (part of vte tarball) results in "abc t". I'll follow up with its maintainer.
Comment 2 Egmont Koblinger 2015-02-20 00:33:34 UTC
s/ancient/old :)  It was fixed for the vte-0.38 series.
Comment 3 ulfalizer 2015-02-20 00:39:23 UTC
At least it's merely old in Ubuntu 14.04 then. :)
Comment 4 Egmont Koblinger 2015-02-20 01:09:50 UTC
You could try to get latest vte (git or tarball), compile, and run locally (without installing) as ./src/vte-2.91.  Please let us know if you experience any other emulation issues there.

Unfortunately it's not easy to install the fix on 14.04.  You can either try to backport the fix to vte-0.36.x and install that system-wide, or go with vte-0.38 but then you need to upgrade gnome-terminal to 3.14, probably requiring to update the whole Gtk+ stack, let alone some hacking with the bash profile scripts.  Or just wait for 2 months and upgrade to 15.04 which will ship these.

*** This bug has been marked as a duplicate of bug 731155 ***
Comment 5 ulfalizer 2015-02-20 01:24:11 UTC
It's not critical. Only produces minor cosmetic annoyances for long commands in a readline + ncurses UI I'm developing. Glad it's been fixed!

Thanks,
Ulf
Comment 6 Christian Persch 2015-02-20 09:04:26 UTC

*** This bug has been marked as a duplicate of bug 731155 ***
Comment 7 Egmont Koblinger 2015-03-03 14:34:00 UTC
FYI: xterm-315 fixes its bug too, the output is "abc t"