Repository navigation
Closed
Labels
Area-SettingsIssues related to settings and customizability, for console or terminalIssues related to settings and customizability, for console or terminalArea-TerminalControlIssues pertaining to the terminal control (input, selection, keybindings, mouse interaction, etc.)Issues pertaining to the terminal control (input, selection, keybindings, mouse interaction, etc.)Help WantedWe encourage anyone to jump in on these.We encourage anyone to jump in on these.In-PRThis issue has a related PRThis issue has a related PRIssue-TaskIt's a feature request, but it doesn't really need a major design.It's a feature request, but it doesn't really need a major design.Product-TerminalThe new Windows Terminal.The new Windows Terminal.good first issueThis is a fix that might be easier for someone to do as a first contributionThis is a fix that might be easier for someone to do as a first contribution
Milestone
Description
In Notepad, if there is a selection, pressing Ctrl+C, the text will be copied to the clipboard, otherwise nothing happens. This is the same in other edit boxes and controls
...
I would like Terminal/PowerShell to behave exactly like Notepad
This seems like a reasonable property to add to the copy action.
class CopyActionArgs {
singleLine: bool = false;
copyFormatting = false;
dismissSelection: bool = false;
}Originally suggested by gaberiel44 in #15349
Note
Walkthrough
- Add a
Boolean DismissSelectiontoCopyTextArgsinsrc\cascadia\TerminalSettingsModel\ActionArgs.idl - Add
DismissSelectiontoCOPY_TEXT_ARGSinActionArgs.h - The actual copy args are retrieved in
TerminalPage::_HandleCopyText(inAppActionHandlers.cpp), and passed toTerminalPage::_CopyText, which calls down toTermControl::CopySelectionToClipboard.- In
CopySelectionToClipboard, just don'tClearSelection.
- In
- This arg will also need localization, in
ActionArgs.cpp,CopyTextArgs::GenerateName, andsrc\cascadia\TerminalSettingsModel\Resources\en-US\Resources.resw
Metadata
Metadata
Assignees
Labels
Area-SettingsIssues related to settings and customizability, for console or terminalIssues related to settings and customizability, for console or terminalArea-TerminalControlIssues pertaining to the terminal control (input, selection, keybindings, mouse interaction, etc.)Issues pertaining to the terminal control (input, selection, keybindings, mouse interaction, etc.)Help WantedWe encourage anyone to jump in on these.We encourage anyone to jump in on these.In-PRThis issue has a related PRThis issue has a related PRIssue-TaskIt's a feature request, but it doesn't really need a major design.It's a feature request, but it doesn't really need a major design.Product-TerminalThe new Windows Terminal.The new Windows Terminal.good first issueThis is a fix that might be easier for someone to do as a first contributionThis is a fix that might be easier for someone to do as a first contribution
Type
Projects
- StatusShow more project fieldsDone
Activity
horrificCoder commentedon May 18, 2023
Mike Griese (@zadjii-msft) Can I work on this?
zadjii-msft commentedon May 18, 2023
Absolutely!
Sayan505 commentedon May 18, 2023
I've got a fix working. I've removed
_core.ClearSelection();fromTermControl.cppwhich leads to the intended behaviour. Is this correct?Looking for feedback on my first ever PR on GitHub. #15383
Sayan505 commentedon May 20, 2023
Mike Griese (@zadjii-msft) Hi, could you please explain me the point of
bool dismissSelection?zadjii-msft commentedon May 23, 2023
Sure - by making this a setting, then users can choose which behavior they want. They could even have both! Like, a user could have the following settings:
And then
Or a user could just rebind ctrl+c to
"action": "copy", "dismissSelection": "false", or whatever!Does that make sense?
code-krishna commentedon May 28, 2023
Mike Griese (@zadjii-msft) can I kindly work on this issue?
Delano5000 commentedon Jun 16, 2023
@/class CopyActionArgs {
singleLine: bool = false;
copyFormatting = false;
dismissSelection: bool = false;
}
rifat01mahmud commentedon Jun 19, 2023
function copyText() {
var selectedText = window.getSelection().toString();
var tempInput = document.createElement("textarea");
tempInput.value = selectedText;
document.body.appendChild(tempInput);
tempInput.select();
document.execCommand("copy");
document.body.removeChild(tempInput);
}
// Call the function when the copy button or any trigger event is activated
copyText();
Rifat Mahmud (Ovronormal)
Added: Copy text without dismissing the selection (#15552)
Added: Copy text without dismissing the selection (microsoft#15552)