View previous topic :: View next topic |
Author |
Message |
xyxx n00b
Joined: 14 Apr 2021 Posts: 7
|
Posted: Fri May 14, 2021 10:45 pm Post subject: [solved] pasted text keeps highlighted in terminal |
|
|
Hello Gentoo community,
I have a weird issue about copying and pasting in terminal. I sometimes copy commands from browser and then paste them into terminal; or just use double click and middle button within terminal to do this. Usually there's no highlight on pasted text. But now the pasted text keeps highlighted until new input from keyboard. Neovim and nano are not affected.
Last night I tried Clear Linux (the official kvm image) in qemu, and I noticed this issue immediately after I quit qemu. Could it be some bug related to qemu/kvm?
I'm using alacritty on X11. No desktop environment. WM is bspwm. I thought it might be some bug of alacritty, so I re-emerged it, no success. Then I emerged st (terminal from suckless.org) but st also has this issue.
Or could it be a new feature from certain recently updated package? If so I'd rather turn it off...
I have no idea how to fix because I don't even know what caused this... I hope someone could help me solve this problem. thanks. _________________ Ich bin eine Maus.
Last edited by xyxx on Sat May 15, 2021 12:38 am; edited 1 time in total |
|
Back to top |
|
|
Chiitoo Administrator
Joined: 28 Feb 2010 Posts: 2575 Location: Here and Away Again
|
|
Back to top |
|
|
xyxx n00b
Joined: 14 Apr 2021 Posts: 7
|
|
Back to top |
|
|
Chiitoo Administrator
Joined: 28 Feb 2010 Posts: 2575 Location: Here and Away Again
|
Posted: Sat May 15, 2021 12:49 am Post subject: |
|
|
Indeed, that is pretty much what I hoped for you to get from it. :]
I, too, found it weird at first, but now I actually like it, and prefer it, mostly due to sometimes having accidentally pasted multiple lines of what-have-you into a terminal... _________________ Kindest of regardses. |
|
Back to top |
|
|
Hu Moderator
Joined: 06 Mar 2007 Posts: 21633
|
Posted: Sat May 15, 2021 2:31 am Post subject: |
|
|
Bracketed paste is a good thing. The highlighting mode, which is unfortunately controlled by the same flag, is more of a mixed bag. Some people dislike it for good reason, and cannot get rid of it without giving up bracketed paste. |
|
Back to top |
|
|
Syl20 l33t
Joined: 04 Aug 2005 Posts: 619 Location: France
|
Posted: Tue Jun 22, 2021 10:00 am Post subject: |
|
|
Hu wrote: | Bracketed paste is a good thing. |
I don't think so.
Since... er... many years, I systematically add some "secure" aliases into my bashrc. Like :
Code: | alias rm='rm -iv'
alias mv='mv -iv' |
and so on. And what happened ? Now, I systematically use "rm -f", to bypass the "-i" behaviour. All the time. Automatically. The cure is worse than the disease.
With this new "we protect you from yourself" feature, my new reflex is to systematically hit the return key. All the time. Automatically. Because I massively use pasted commands, and that behaviour makes me waste lots of time. |
|
Back to top |
|
|
qsmodo Tux's lil' helper
Joined: 20 Jun 2021 Posts: 82
|
Posted: Tue Jun 22, 2021 2:00 pm Post subject: |
|
|
Syl20 wrote: | With this new "we protect you from yourself" feature, my new reflex is to systematically hit the return key. All the time. Automatically. Because I massively use pasted commands, and that behaviour makes me waste lots of time. |
With bracketed past, if the copied ext contains hidden control characters, they will be obvious when pasting into the terminal. And it won't auto-execute the command if contains a newline character. You have a choice to not hit Return blindly or not. For those who use it appropriately, bracketed paste is positively, objectively an improvement. |
|
Back to top |
|
|
pjp Administrator
Joined: 16 Apr 2002 Posts: 20067
|
Posted: Tue Jun 22, 2021 6:24 pm Post subject: |
|
|
The point of it being a reflex explicitly makes it not a choice. It is the CLI version of clicking 'OK' in Windows and what most people seemingly complained about in Vista with its User Account Control.
I've gotten into the habit of using -i with cp and mv. I sometimes find myself hitting return too quickly, particularly if I'm doing a lot of work with file management. I've always disliked having to use -f with rm, and I become slightly "anxious" when I think about using -r (and "less slightly" when I do use it). These and similar commands seem like they'd benefit most from --pretend or --dry-run.
Having bracketed past is an objective security "good." That doesn't mean its implementation is objectively good. _________________ Quis separabit? Quo animo? |
|
Back to top |
|
|
Hu Moderator
Joined: 06 Mar 2007 Posts: 21633
|
Posted: Wed Jun 23, 2021 1:44 am Post subject: |
|
|
Syl20 wrote: | Hu wrote: | Bracketed paste is a good thing. | I don't think so.
Since... er... many years, I systematically add some "secure" aliases into my bashrc. Like : Code: | alias rm='rm -iv'
alias mv='mv -iv' | and so on. And what happened ? Now, I systematically use "rm -f", to bypass the "-i" behaviour. All the time. Automatically. The cure is worse than the disease. | I always remove those aliases as soon as I find them, because certain distributions are very bad about shipping those as defaults. I consider it better to just remove the alias outright, rather than always append a -f. Syl20 wrote: | With this new "we protect you from yourself" feature, my new reflex is to systematically hit the return key. All the time. Automatically. Because I massively use pasted commands, and that behaviour makes me waste lots of time. | You use paste much more than I do. I find the bracketed paste to be almost always a positive, because I rarely paste a command in a ready-to-execute form. My pastes into a terminal fall into three categories:- Accidental due to an over-sensitive touchpad. Rare, but irritating.
- Intentional partial command. Bracketed paste mode would have no effect here. I will finish out the command by hand, then execute it.
- Intentional full command. Bracketed paste inhibits this running automatically. Usually, I like that I get a last chance to review it before it executes. This helps if the command was copied from a web page, as the browser may not have copied exactly the sequence I wanted (e.g. trailing garbage characters may have slipped in).
If you paste commands as much as you say, you should disable bracketed paste. Although, I would also question your workflow. What are you doing that you paste so much? Would you be better off storing these commands in scripts that you can run? |
|
Back to top |
|
|
figueroa Advocate
Joined: 14 Aug 2005 Posts: 2963 Location: Edge of marsh USA
|
Posted: Wed Jun 23, 2021 2:34 am Post subject: |
|
|
I like it, but it would have been a capital opportunity to broadcast the change in news rather than having to discover it through trial error.
I always alias cp, mv, and rm with cp -i, mv -i, rm -i. Those are life savers. I also have excellent backups. _________________ Andy Figueroa
hp pavilion hpe h8-1260t/2AB5; spinning rust x3
i7-2600 @ 3.40GHz; 16 gb; Radeon HD 7570
amd64/23.0/split-usr/desktop (stable), OpenRC, -systemd -pulseaudio -uefi |
|
Back to top |
|
|
Syl20 l33t
Joined: 04 Aug 2005 Posts: 619 Location: France
|
Posted: Tue Jul 13, 2021 10:43 am Post subject: |
|
|
Hu wrote: | What are you doing that you paste so much? Would you be better off storing these commands in scripts that you can run? |
For example, I replaced ntp by chrony on my seven boxes recently. About a dozen of commands, some with interactions, et some without. Unique usage.
I think seven boxes isn't enough to use softwares like ansible or puppet, that require some "scripting" for each task anyway. But it's enough to be bored when doing the same task on all of them. So I make the changes on one "test" box, and I copy-paste the commands into the others boxes' terminals. |
|
Back to top |
|
|
Hu Moderator
Joined: 06 Mar 2007 Posts: 21633
|
Posted: Wed Jul 14, 2021 1:14 am Post subject: |
|
|
For that many systems, I would have written up a straight-line script, probably with no error handling, but just collecting up the commands to be pasted. Then scp it to all the systems, and run it. Alternatively, I might have copied that into a tmux copy buffer and pasted from there. If the paste is done without -p, then tmux will not generate the bracketed-paste wrapper characters, and the receiving shell will treat it as typed. |
|
Back to top |
|
|
turtles Veteran
Joined: 31 Dec 2004 Posts: 1657
|
|
Back to top |
|
|
|