-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added: Copy text without dismissing the selection #15552
Added: Copy text without dismissing the selection #15552
Conversation
@microsoft-github-policy-service agree |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! I even tested it out myself. Thanks! There's a few more things you need to do before I sign off on this though:
- update the schema
- fix the localization stuff
if (DismissSelection()) | ||
{ | ||
ss << RS_(L"DismissSelectionCommandKey").c_str(); | ||
} | ||
else | ||
{ | ||
ss << RS_(L"DismissSelectionFalseCommandKey").c_str(); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're going to have to move this somewhere else in this method. So, here's how this function works:
- if
singleLine: true
--> the command palette displays the action as "Copy text as a single line" - otherwise --> "Copy text"
- if
copyFormatting
is set, we append "copyFormatting: "
Honestly, the easiest approach I recommend is appending "dismissSelection: false" to the string if dismissSelection: false
.
@DHowett @nguyen-dows Thoughts? Y'all are generally good at wordsmithing stuff.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The truth is that I have programmed it a bit by intuition. Where do these strings appear/be used for? I haven't had much time to investigate. I guess I'll wait for others to comment on this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problem! haha GenerateName()
spits out the localized string version of the action. These get displayed in the command palette and in the actions page of the settings UI.
<data name="DismissSelectionCommandKey" xml:space="preserve"> | ||
<value>DismissSelectionCommandKey</value> | ||
<comment>DismissSelectionCommandKey</comment> | ||
</data> | ||
<data name="DismissSelectionFalseCommandKey" xml:space="preserve"> | ||
<value>DismissSelectionFalseCommandKey</value> | ||
<comment>DismissSelectionFalseCommandKey</comment> | ||
</data> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Building off of my comments in ActionArgs.cpp.
If you go with my suggestion of dismissSelection: false
, you can delete these changes/keys.
If we end up going with an approach that'll be translated (i.e. how the CopyText
key is translated to "Copy text"), you'll want to keep these keys, but replace the content of <value>
with the translated string.
Also, what's the repro for this?
|
I think it's a Visual Studio thing because I've done some testing and it only happens if you start typing in the terminal when Visual Studio hasn't fully loaded the debug menus yet. When I have time I'll upload some gifs showing it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I'll go ahead and resolve the comment I made and clean up the PR body before merging it. Nice work 😊
src/cascadia/TerminalSettingsModel/Resources/en-US/Resources.resw
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
taking some time to look at this myself
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly what I would have done, thanks!
## Summary of the Pull Request Adds a dismiss selection option to the "copy" action. ## PR Checklist - [x] Closes microsoft#15371 - [x] Tests added/passed - [x] Documentation updated - If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/terminal) and link it here: MicrosoftDocs/terminal#686 - [x] Schema updated (if necessary) --------- Co-authored-by: Carlos Zamora <carlos.zamora@microsoft.com>
Summary of the Pull Request
Adds a dismiss selection option to the "copy" action.
PR Checklist