[Bug 1926256] Re: Pasted text in the terminal is always highlighted and selected
Egmont Koblinger
1926256 at bugs.launchpad.net
Thu May 13 22:24:29 UTC 2021
This is not an issue with the terminals, this is a new feature of
bash-5.1. Search for the word "highlight" at
https://lists.gnu.org/archive/html/info-gnu/2020-12/msg00003.html .
---
This could not theoretically be a bug in gnome-terminal/vte. Terminals
don't directly paint a letter as a consequence of the user pressing that
letter, or pasting something.
I'm certain you can think of plenty of cases where pressing a certain
letter does not cause that letter to be painted on the canvas, but some
other action (larger repaints), or perhaps nothing at all.
When you press a letter, or paste some text, it is forwarded towards the
kernel over the tty line, but is not displayed. The kernel then might
handle it itself, or forward further towards some application (e.g. bash
in this case).
Then that application may or may not decide to paint something. Whatever
it decides to paint may or may not be the same as the typed letter or
pasted text. But even if it's the same, the terminal has no way of
making this connection. "The user pressed the letter X, I've forwarded
it, 100 milliseconds later I received a letter X to be painted, it must
be the «same» X" -- it cannot work like this.
What happens in this particular case is that you paste "foo", and in
response bash instructs the terminal to print "foo" in inverse colors.
The terminal does what it must do: obeys this instuction (without having
the slightest idea that it's related to the paste).
---
Two more things to mention to complete the picture:
There is a so-called "bracketed paste mode", where special markers are
inserted at the beginning and end of pasted data. This is how
applications (bash in this case) can distinguish it from data typed by
the user, without relying on timing heuristics.
Also, some terminals have a legacy "local echo" mode where pressed keys
immediately appear on the screen. I'm fairly certain it's not used
anywhere nowadays. Most terminals don't support it, and VTE removed it
in version 0.60, see https://gitlab.gnome.org/GNOME/vte/-/issues/69 .
** Bug watch added: gitlab.gnome.org/GNOME/vte/-/issues #69
https://gitlab.gnome.org/GNOME/vte/-/issues/69
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to bash in Ubuntu.
https://bugs.launchpad.net/bugs/1926256
Title:
Pasted text in the terminal is always highlighted and selected
Status in bash package in Ubuntu:
Confirmed
Status in gnome-terminal package in Ubuntu:
Invalid
Status in mate-terminal package in Ubuntu:
Confirmed
Status in vte2.91 package in Ubuntu:
Confirmed
Bug description:
Steps to reproduce:
1. Have Ubuntu 21.04 installed
2. Launch terminal
3a. Execute some command, select this command to copy it, then paste command
3b. Paste some command from clipboard to terminal
Expected result:
* pasted command is not highlighted and is not selected
Actual result:
* pasted command is selected and highlighted
ProblemType: Bug
DistroRelease: Ubuntu 21.04
Package: mate-terminal 1.24.1-1
ProcVersionSignature: Ubuntu 5.11.0-16.17-generic 5.11.12
Uname: Linux 5.11.0-16-generic x86_64
ApportVersion: 2.20.11-0ubuntu65
Architecture: amd64
CasperMD5CheckResult: pass
CurrentDesktop: MATE
Date: Tue Apr 27 09:43:56 2021
InstallationDate: Installed on 2021-04-23 (3 days ago)
InstallationMedia: Ubuntu-MATE 21.04 "Hirsute Hippo" - Release amd64 (20210420)
SourcePackage: mate-terminal
UpgradeStatus: No upgrade log present (probably fresh install)
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/bash/+bug/1926256/+subscriptions
More information about the foundations-bugs
mailing list