CTRL+INSERT doesn't copy keyboard-selected text in PowerShell + PowerShell Core #14478

Closed
opened 2026-01-31 04:11:24 +00:00 by claunia · 3 comments
Owner

Originally created by @knuth-konrad on GitHub (Jul 12, 2021).

Windows Terminal version (or Windows build number)

10.0.19043.0 Microsoft Windows NT 10.0.19043.0

Other Software

Perhaps PowerShell (see section 'Actual behavior' below for details)

PowerShell:

Name                           Value
----                           -----
PSVersion                      5.1.19041.1023
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.19041.1023
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

PowerShell Core:

Name                           Value
----                           -----
PSVersion                      7.1.3
PSEdition                      Core
GitCommitId                    7.1.3
OS                             Microsoft Windows 10.0.19043
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Steps to reproduce

  • Select any text with Shift + [+Ctrl] + arrow keys
  • Use Ctrl+Insert to copy the text to clipboard (note that the selection goes away)
  • Try pasting the supposedly copied text using Shift + Insert or Ctrl+V somewhere else

Expected Behavior

Selected text is copied to clipboard.

Actual Behavior

None.

Either the previous clipboard content is pasted or nothing (empty clipboard)

Noteworthy is the fact that this only occurs in both PowerShell and PowerShell Core, whereas e.g. in a Cmd or WSL terminal, the selection is copied to the clipboard.

To verify that Ctrl+Insert (copy) is the culprit, not Shift+Insert (paste), I used Ctrl+C for copying and Shift+Insert for pasting and that does work as expected.

Another interesting observation is that text select via mouse does get copied to the clipboard. It's only text selected via keyboard that fails to being copied.

Originally created by @knuth-konrad on GitHub (Jul 12, 2021). ### Windows Terminal version (or Windows build number) 10.0.19043.0 Microsoft Windows NT 10.0.19043.0 ### Other Software Perhaps PowerShell _(see section 'Actual behavior' below for details)_ PowerShell: ``` Name Value ---- ----- PSVersion 5.1.19041.1023 PSEdition Desktop PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...} BuildVersion 10.0.19041.1023 CLRVersion 4.0.30319.42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1 ``` PowerShell Core: ``` Name Value ---- ----- PSVersion 7.1.3 PSEdition Core GitCommitId 7.1.3 OS Microsoft Windows 10.0.19043 Platform Win32NT PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…} PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1 WSManStackVersion 3.0 ``` ### Steps to reproduce - Select any text with Shift + [+Ctrl] + arrow keys - Use Ctrl+Insert to copy the text to clipboard _(note that the selection goes away)_ - Try pasting the supposedly copied text using Shift + Insert or Ctrl+V somewhere else ### Expected Behavior Selected text is copied to clipboard. ### Actual Behavior None. Either the previous clipboard content is pasted or nothing _(empty clipboard)_ Noteworthy is the fact that this only occurs in both PowerShell and PowerShell Core, whereas e.g. in a Cmd or WSL terminal, the selection **is** copied to the clipboard. To verify that Ctrl+Insert _(copy)_ is the culprit, not Shift+Insert _(paste)_, I used Ctrl+C for copying and Shift+Insert for pasting and that _does_ work as expected. Another interesting observation is that text select via mouse does get copied to the clipboard. It's only text selected via keyboard that fails to being copied.
claunia added the Issue-QuestionNeeds-TriageNeeds-Tag-FixResolution-Answered labels 2026-01-31 04:11:24 +00:00
Author
Owner

@peetrike commented on GitHub (Jul 15, 2021):

PowerShell uses PSReadLine module to handle keyboard shortcuts. There is keybinding in PSReadLine for Ctrl-C (and Ctrl-Shift-C), but not for Ctrl-Insert

@peetrike commented on GitHub (Jul 15, 2021): PowerShell uses PSReadLine module to handle keyboard shortcuts. There is keybinding in PSReadLine for Ctrl-C (and Ctrl-Shift-C), but not for Ctrl-Insert
Author
Owner

@zadjii-msft commented on GitHub (Jul 19, 2021):

Okay, so this is a little complicated. The Terminal doesn't actually support selecting text with the keyboard yet. So the selection that you get in PowerShell via the keyboard is actually something that PowerShell is doing itself, not something managed by the Terminal.

ctrl+insert is a keybinding that's managed by the Terminal. It can only work on a selection that the Terminal itself manages. That's why the selection created by PowerShell seemingly can't be copied by the Terminal.

You could configure PsReadline to copy on ctrl+insert, or you could wait for #2840/#715 to land, so that the Terminal can select text via the keyboard itself.

@zadjii-msft commented on GitHub (Jul 19, 2021): Okay, so this is a little complicated. The Terminal doesn't actually support selecting text with the keyboard yet. So the selection that you get in PowerShell via the keyboard is actually something that PowerShell is doing itself, not something managed by the Terminal. <kbd>ctrl+insert</kbd> is a keybinding that's managed by the Terminal. It can only work on a selection that the Terminal itself manages. That's why the selection created by PowerShell seemingly can't be copied by the Terminal. You could configure PsReadline to copy on ctrl+insert, or you could wait for #2840/#715 to land, so that the Terminal can select text via the keyboard itself.
Author
Owner

@knuth-konrad commented on GitHub (Jul 20, 2021):

Many thanks for the explanation, folks. Not being a power-PowerShell user, I learned about PSReadLine here, of which I was unaware before. So something good came out of it (for me).

And both PRs also read good to me.

@knuth-konrad commented on GitHub (Jul 20, 2021): Many thanks for the explanation, folks. Not being a power-PowerShell user, I learned about PSReadLine here, of which I was unaware before. So something good came out of it _(for me)_. And both PRs also read good to me.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#14478