In Ubuntu 21.04, when text is pasted into Gnome Terminal, the text is always highlighted.
- It appears as if the text is selected, but it is only highlighted.
- If you right-click on this highlighted text, the "Copy" option is actually disabled.
- Clicking in the terminal or clicking on the highlighted text does not un-highlight the text.
- The only way to un-highlight the pasted text is to type a key.
- If you try to select the highlighted text by clicking and dragging the mouse pointer, the text color actually inverts, and the text looks like it is not selected, when it in fact is selected.
This confusing behavior is not present in Ubuntu 20.04.
- In Ubuntu 20.04, when text is pasted into Gnome Terminal, the text is not highlighted.
- Then, selecting the text highlights it, as expected.
How to revert this confusing behavior of Gnome Terminal in Ubuntu 21.04, so it behaves like Gnome Terminal in Ubuntu 20.04 ?
I also noticed this behavior after upgrade to 21.04. Don't think this as a bug: It is a new "default setting" in Bash 5.1.
First check:
Then, try to disable (for the current session):
And retry your findings in that terminal session. This is also explained in: https://stackoverflow.com/questions/35611134/bash-bracketed-paste-is-it-supported
I would suggest living with this new default setting of Bash, since it prevents the accidental middle-clicking or copy/pasting of multiple lines (consisting of possibly malicious commands) from the clipboard.
This is a new "feature" in Bash. Should be reverted to previous defaults as soon as possible, IMO.
I'm seeing this bug in default MATE Terminal on fresh installation of 21.04 too,
so I have reported it to launchpad as bug 1926256 . Please mark yourself as affected by this bug and add a comment about GNOME Terminal use-case.
As suggested here, you can change the Gnome Terminal highlight color to something other than white, so it does not conflict with the "bracketed paste" feature of bash.
Click on the header bar menu button in Gnome Terminal
Click "Preferences"
Under "Profile" in the left pane, select your profile (i.e. "Unnamed")
Click the "Colors" tab
Check-mark "Highlight Colors"
Click the Background color box (the second box)
Enter the hexadecimal value for the highlight color you want to use.
You may want to chose one of the colors from the official Ubuntu Color Pallet:
Click the Select button to apply your change.
After making this change:
The "bracketed paste" text will be highlighted in white, per the changes to bash.
(See "AND THIS IS PASTED" text in the screenshot).
Text that you select using gnome-terminal will be your chosen color from step 4 above.
(See "THIS IS SELECTED" text in the screenshot).