terminal icon indicating copy to clipboard operation
terminal copied to clipboard

Text selection using keyboard (Shift + arrow keys)

Open vineethrp opened this issue 7 years ago • 15 comments

Description of the new feature/enhancement

We can currently select text in the terminal by dragging mouse with key pressed. Linux terminals and Windows command prompt allows you to select text by also Shift + arrow keys. I have tried this in the Windows terminal and instead of selecting the texts it just prints characters (Shift + right arrow prints 'D' for me).

Would be great to have the keyboard method for text selection for windows users. Would be very helpful for keyboard heavy users

Update

I checked that powershell on terminal works as expected cmd on terminal doesn't print extra characters, the cursor just moves instead of selection WSL prints extra characters (shift + right => D, Shift + left => C, etc)

vineethrp avatar Aug 09 '19 13:08 vineethrp

I believe this is a duplicate of #715

cinnamon-msft avatar Aug 09 '19 20:08 cinnamon-msft

I checked the feature from #715. This is not a duplicate. With above feature, the mentioned Shift + Ctrl + Arrow and Shift + Arrow keys still do not work in all modes. Only works in Powershell. Does not work in Command shell and also not in WSL Bash. Note, that CMD.exe supports those keys, but it works only when used without the terminal.

mfriedrich74 avatar May 22 '23 19:05 mfriedrich74

Yeah mark mode isn't a substitution for this just working as expected in my opinion.

I use a macbook and iterm2 for work and use ctrl shift to highlight, copy, paste text dozens of times a day. This is a pretty serious UX gap when I try to use WSL/Terminal on my personal computer.

bpinske avatar Jul 10 '23 18:07 bpinske

@bpinske have you tried adding a keybinding like:

        { "command": "markMode", "keys": "shift+left" },

That'll just immediately enter mark mode when you hit shift+left. It's like, one extra keystroke, but the UX is effectively the same.

zadjii-msft avatar Jul 10 '23 19:07 zadjii-msft

I will give that a shot later this evening. Thanks for the suggestion.

bpinske avatar Jul 10 '23 19:07 bpinske

I believe this is a duplicate of #715

It is not a duplicate Shift + Ctrl + Arrow and Shift + Arrow keys still do not work in all modes. It only works in Powershell. Markdown mode isn't enough. When you try to delete selected text with it will just delete the last character in cmd

aliulashayir avatar Aug 01 '23 20:08 aliulashayir

@aliulashayir That's entirely a different thing. PowerShell maintains its own "selection" separate from the Terminal's. CMD.exe doesn't implement anything like that. It doesn't know how to backspace multiple characters at a time, and it doesn't know where the Terminal's selection is.

This is an unfortunately weird aspect about the separation between shells and terminals.

zadjii-msft avatar Aug 01 '23 20:08 zadjii-msft

@zadjii-msft Oh, I didn't know that. It is annoying that these are not implemented the same way. I mean in the cmd without the new terminal app you can select with ctrl + shift + arrow key and then ctrl + backspace deletes the selection but you can't do it in the terminal app cmd

aliulashayir avatar Aug 02 '23 00:08 aliulashayir

in the cmd without the new terminal app you can select with ctrl + shift + arrow key and then ctrl + backspace deletes the selection

Does it though? ctrl+bksp will delete the previous word, but I don't believe it'll delete the entire selection:

e786f81c-aab1-46f5-bbf5-8b41319bbc52

zadjii-msft avatar Aug 02 '23 16:08 zadjii-msft

@zadjii-msft Yes sorry I meant this but wrote it incorrectly. Still, this is better than nothing. For example, this is still useful when you are using a tool like yt-dlp and want to quickly delete a URL or something it is treated like a single word selection. I use, copy&paste URL s a lot so it is a nice to have ezgif-3-34dca50bec

aliulashayir avatar Aug 02 '23 19:08 aliulashayir

I mean, Ctrl+Bksp will delete the previous "word" in CMD regardless of having text selected or not (in both Terminal and conhost).

zadjii-msft avatar Aug 02 '23 20:08 zadjii-msft

yes but can't select copy it though on Terminal cmd because you can't select the word and I guess not seeing the text highlighted just messes with my muscle memory. It is just a bit annoying that Powershell, cmd, wsl are different. Not a big problem. Thank you for your answers. I really appreciate that someone who works on the project takes the time to answer 🥇

aliulashayir avatar Aug 02 '23 23:08 aliulashayir

@zadjii-msft Is there a way this can be implemented? It's really annoying not to be able to use Shift+arrow keys (standard LUA shortcuts for text editing for like at least 3-4 decades now).

levicki avatar Jul 18 '24 14:07 levicki

@aliulashayir That's entirely a different thing. PowerShell maintains its own "selection" separate from the Terminal's. CMD.exe doesn't implement anything like that. It doesn't know how to backspace multiple characters at a time, and it doesn't know where the Terminal's selection is.

This is an unfortunately weird aspect about the separation between shells and terminals.

But you can select text with shift+arrow-keys in the legacy cmd prompt (W10)! That contradict the above statement, that it's not possible to get the functionality with cmd.

BWWIT avatar Nov 09 '24 09:11 BWWIT

so this will neer implemented?? why is this closed

myudak avatar Nov 28 '24 22:11 myudak