Pasting to tab title leaking to terminal input #20706

Closed
opened 2026-01-31 07:21:46 +00:00 by claunia · 6 comments
Owner

Originally created by @pszlazak on GitHub (Oct 20, 2023).

Windows Terminal version

1.18.2822.0

Windows build number

10.0.22621.0

Other Software

N/A

Steps to reproduce

  • copy some text to the clipboard
  • paste it to tab tile using keyboard shortcut Ctrl+v

Expected Behavior

Clipboard content pasted only to tab title.

Actual Behavior

Clipboard content will be pasted to tab title and to terminal input as shown here: https://i.imgur.com/UlFcGNe.gif

Remark: if clipboard is pasted using right click and context menu, it works OK.

Originally created by @pszlazak on GitHub (Oct 20, 2023). ### Windows Terminal version 1.18.2822.0 ### Windows build number 10.0.22621.0 ### Other Software N/A ### Steps to reproduce * copy some text to the clipboard * paste it to tab tile **using keyboard shortcut** `Ctrl+v` ### Expected Behavior Clipboard content pasted only to tab title. ### Actual Behavior Clipboard content will be pasted to tab title and to terminal input as shown here: https://i.imgur.com/UlFcGNe.gif Remark: if clipboard is pasted using right click and context menu, it works OK.
claunia added the Issue-BugResolution-Duplicate labels 2026-01-31 07:21:46 +00:00
Author
Owner

@Shivansh20128 commented on GitHub (Oct 21, 2023):

Hi @pszlazak,
The issue you are talking about is not a bug but rather a feature to make things easier for developers. the behavior you described is due to a feature called "injection" in Windows Terminal. This feature allows you to paste text into the title bar and automatically sends that text to the command prompt as well. It's designed to make it convenient for users to rename the terminal while also executing a command.
As you said, if the clipboard is pasted using the right-click and context menu, it works fine.
However, if you want to use keyboard shortcut keys, here is a way to avoid pasting clipboard text at both places:

  1. Click on the down arrow in the title bar and select "Settings." You should be able to find a "Settings.json" file.
  2. Inside the file, you should be able to find
    {
    "command": "paste",
    "keys": "ctrl+v"
    }
    in the "actions" key.
  3. This setting defines the shortcut to paste inside the terminal. Since Windows also pastes the clipboard text using Ctrl+v, when some text is pasted into the terminal title using Ctrl+v, it gets pasted into the title due to Windows-defined settings as well as inside the terminal due to the setting defined in this "Settings.json" file.
  4. To avoid pasting text at both places, modify this file and change the shortcut key from "ctrl+v" to some other key combination that does not clash with any other shortcut keys.
  5. Save the file and close and open the terminal again.

You should now be able to paste the copied text into the terminal title using "ctrl+v" and into the terminal using the new key combination you defined in the "Settings.json" file.
Thank You

@Shivansh20128 commented on GitHub (Oct 21, 2023): Hi @pszlazak, The issue you are talking about is not a bug but rather a feature to make things easier for developers. the behavior you described is due to a feature called "injection" in Windows Terminal. This feature allows you to paste text into the title bar and automatically sends that text to the command prompt as well. It's designed to make it convenient for users to rename the terminal while also executing a command. As you said, if the clipboard is pasted using the right-click and context menu, it works fine. However, if you want to use keyboard shortcut keys, here is a way to avoid pasting clipboard text at both places: 1. Click on the down arrow in the title bar and select "Settings." You should be able to find a "Settings.json" file. 2. Inside the file, you should be able to find { "command": "paste", "keys": "ctrl+v" } in the "actions" key. 3. This setting defines the shortcut to paste inside the terminal. Since Windows also pastes the clipboard text using Ctrl+v, when some text is pasted into the terminal title using Ctrl+v, it gets pasted into the title due to Windows-defined settings as well as inside the terminal due to the setting defined in this "Settings.json" file. 4. To avoid pasting text at both places, modify this file and change the shortcut key from "ctrl+v" to some other key combination that does not clash with any other shortcut keys. 5. Save the file and close and open the terminal again. You should now be able to paste the copied text into the terminal title using "ctrl+v" and into the terminal using the new key combination you defined in the "Settings.json" file. Thank You
Author
Owner

@pszlazak commented on GitHub (Oct 22, 2023):

If this is a feature it became present in v1.12.10334.0. Earlier it was not there. This is the first stable version of v1.12.
Previous released preview version v1.12.3472.0 still does not have this feature.

I don't see this feature being announced in release notes of v1.12.10334.0.

It was added by one of following commits: https://github.com/microsoft/terminal/compare/v1.12.3472.0...v1.12.10334.0

@pszlazak commented on GitHub (Oct 22, 2023): If this is a feature it became present in [v1.12.10334.0](https://github.com/microsoft/terminal/releases/tag/v1.12.10334.0). Earlier it was not there. This is the first stable version of v1.12. Previous released preview version [v1.12.3472.0](https://github.com/microsoft/terminal/releases/download/v1.12.3472.0/Microsoft.WindowsTerminalPreview_1.12.3472.0_8wekyb3d8bbwe.msixbundle) still does not have this feature. I don't see this feature being announced in release notes of [v1.12.10334.0](https://github.com/microsoft/terminal/releases/tag/v1.12.10334.0). It was added by one of following commits: https://github.com/microsoft/terminal/compare/v1.12.3472.0...v1.12.10334.0
Author
Owner

@DHowett commented on GitHub (Oct 23, 2023):

This feature allows you to paste text into the title bar and automatically sends that text to the command prompt as well. It's designed to make it convenient for users to rename the terminal while also executing a command.

We definitely don't do this on purpose. This is absolutely a bug (and a somewhat pernicious one, which keeps biting us because of the input architecture hole we dug ourselves into) and not a feature.

@DHowett commented on GitHub (Oct 23, 2023): > This feature allows you to paste text into the title bar and automatically sends that text to the command prompt as well. It's designed to make it convenient for users to rename the terminal while also executing a command. We definitely don't do this on purpose. This is absolutely a bug (and a somewhat pernicious one, which keeps biting us because of the input architecture hole we dug ourselves into) and not a feature.
Author
Owner

@Shivansh20128 commented on GitHub (Oct 23, 2023):

Okay. It may be a bug.
But I still feel that the current behavior is obvious because when we select the title, we are also selecting the whole terminal. And then when we press Ctrl+v, the text gets pasted in the title because of the default setting of the operating system, as well as inside the terminal because of the setting we have defined in the Settings.json file for the terminal.

@Shivansh20128 commented on GitHub (Oct 23, 2023): Okay. It may be a bug. But I still feel that the current behavior is obvious because when we select the title, we are also selecting the whole terminal. And then when we press Ctrl+v, the text gets pasted in the title because of the default setting of the operating system, as well as inside the terminal because of the setting we have defined in the Settings.json file for the terminal.
Author
Owner

@zadjii-msft commented on GitHub (Oct 24, 2023):

I'm certain this isn't by design. Pretty sure #14669 has a fix for this, which should be tracked in /dup #14381. Thanks!

@zadjii-msft commented on GitHub (Oct 24, 2023): I'm certain this isn't by design. Pretty sure #14669 has a fix for this, which should be tracked in /dup #14381. Thanks!
Author
Owner

@microsoft-github-policy-service[bot] commented on GitHub (Oct 24, 2023):

Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!

@microsoft-github-policy-service[bot] commented on GitHub (Oct 24, 2023): Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report! <!-- Policy app identification https://img.shields.io/static/v1?label=PullRequestIssueManagement. -->
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#20706