News for hackers. Stuff that matters.
Re:Entering text in the terminal is complicated by Uehreka on Monday July 08, 2024 @04:24PM (#40909286)
So when I use Windows Terminal and I press Ctrl-C, it always does the right thing: If I’m selecting text I want to copy it, if I’m not selecting text I want to kill the running process.

On Linux, every Terminal app I’ve used stubbornly refuses to copy when I press Ctrl-C, demanding I press Ctrl-Shift-C. When I paste, if I forget my manners and use Ctrl-V instead of Ctrl-Shift-V, I am punished by getting a weird character when I start typing again. And I am constantly pressing Ctrl-V because of muscle memory since no other app works this way.

Is there any terminal app for Linux that does things the Windows Terminal way and won’t slap me on the wrist for Improper Teletype Usage?

Re:Entering text in the terminal is complicated by sureglymop on Monday July 08, 2024 @07:50PM (#40911038)
I think you could achieve this in Wezterm, which is configurable with lua. Not on my laptop right now but will try to get it working later. I have other keybinds that run specific lua functions.
Re:Entering text in the terminal is complicated by tomtom1337 on Tuesday July 09, 2024 @02:47AM (#40913156)
Please do share what you learn! I'm considering switching from mac to Linux, and wezterm is my daily driver.
Re:Entering text in the terminal is complicated by cellularmitosis on Monday July 08, 2024 @07:24PM (#40910862)
Its funny, the thing which most keeps me on a Mac is simply the disambiguation of copy vs kill (Command-C vs Ctrl-c) in the terminal.
Re:Entering text in the terminal is complicated by ordu on Monday July 08, 2024 @05:17PM (#40909805)
I copy from/to terminal with middle mouse button. Just select some text and click middle button where you want to paste the text. Some people don't like it because it needs a mouse, they prefer to keep their hands on the keyboard, but I don't see any issues with it.

This way to copy/paste uses it's own Xorg buffer, so you can copy something with Ctrl-C and select something else, and then Ctrl-V will paste the first thing and middle click the second. I have issues using Windows and smartphones because I sometimes try to copy by just selecting things, forgetting to hit Ctrl-C or something. It is really annoying.

> Is there any terminal app for Linux that does things the Windows Terminal way and won’t slap me on the wrist for Improper Teletype Usage?

I think not. The trouble is programs running in terminal may want to deal with Ctrl-C by themselves. Text editors for example do that, but terminals have no way to know it. Terminals even don't know what program is running now, because job control is a job of a shell.

Re:Entering text in the terminal is complicated by Uehreka on Monday July 08, 2024 @07:04PM (#40910715)
> The trouble is programs running in terminal may want to deal with Ctrl-C by themselves. Text editors for example do that, but terminals have no way to know it. Terminals even don't know what program is running now, because job control is a job of a shell.

But then why does Windows Terminal (even when running against WSL) not have this problem? The terminal doesn’t need to know what’s running inside it to know “if text is selected, intercept Ctrl-C and copy the selected text”.

Re:Entering text in the terminal is complicated by ordu on Tuesday July 09, 2024 @02:21AM (#40913019)
Idk, but I can guess. In windows terminal and shell are not so separate as in Unix. For example, is cmd.exe is a terminal or a shell? I believe it is both. Probably it is the same with powershell.
Re:Entering text in the terminal is complicated by jasomill on Tuesday July 09, 2024 @08:27AM (#40915282)
This is a mistake, but forgivable, as Windows executable launch behavior blurs this distinction.

Just like UNIX shells, cmd and PowerShell are ordinary console programs.

The Windows equivalent to xterm and friends — i.e., the mechanism responsible for displaying console I/O in a window — is a bit complicated, has changed over time, and only recently (Windows 10 1809 / Server 2019) adopted a UNIX-like pseudo tty / terminal emulator model.

For a good overview of Windows console architecture, past and present, see

https://devblogs.microsoft.com/commandline/windows-command-l...

Re:Entering text in the terminal is complicated by FooBarWidget on Monday July 08, 2024 @04:55PM (#40909587)
I've always configured my terminal to copy on select. I never press ctrl-c. I mean, why would I want to select text if not to copy it?
Re:Entering text in the terminal is complicated by agapon on Monday July 08, 2024 @05:02PM (#40909660)
E.g., to press Ctrl-(Shift)-V and replace the selection with something you copied (to the buffer / clipboard) earlier?
Re:Entering text in the terminal is complicated by kragen on Monday July 08, 2024 @07:53PM (#40911057)
that doesn't work in terminal emulators because the terminal emulator doesn't know how to delete the selected text in whatever program drew it there (which may no longer even exist)
Re:Entering text in the terminal is complicated by aumerle on Tuesday July 09, 2024 @11:16PM (#40923374)
Most decent linux terminals let you configure this. For example in kitty:

map ctrl+c copy_or_interrupt

https://sw.kovidgoyal.net/kitty/actions/#action-copy_or_inte...