GNOME Bugzilla – Bug 780011
Weird bash line editing and soft vs hard newline issue
Last modified: 2017-03-20 21:37:13 UTC
Created attachment 347896 [details] typescript bash-4.3.46 on Ubuntu Yakkety, I execute three commands: First: echo http://foo.example.com Second: A command that's long enough to wrap to two lines while I type it Third: Press the Up arrow twice to re-echo the URL At the first command, the URLs (both the one I typed and the one echoed back) behave as expected on mouseover. At the last command, the URL I typed is underlined on hover along with the next line's "http", and the rest of the echoed back URL is never highlighted. Also, on a window resize (rewrap) these two lines becomes joined together. So basically vte thinks it's a soft linewrap near the middle of the line. Instead of reproducing with bash, you can just as well cat the attached typescript with the standard 80 columns. We should examine what's going on and whether VTE can be improved here. E.g. I can see a "\e36P" (delete 36 characters from the right) in the typescript, this is really suspicious. Maybe seeing such a character should change the line to be hard wrapped. Maybe this would also improve the experience of zsh users (they tend to see lots of artifacts due to rewrap on resize).
I've checked xterm and indeed it's different here: an \e[P switches the current line to hard wrapped. Makes sense, we should do it too. (Note: that's what both xterm and vte does on \e[K.) (I don't know if xterm can do auto-highlight of URLs, but copy-pasting as well as triple click reveals the hard vs. soft line ending.)
Created attachment 347951 [details] [review] Fix
Committed to master (aka. 0-49).