-
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 CopyOnSelect as a Global Setting #2152
Conversation
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.
Should the selection disappear? That's not how it works on other terminals. Also, if it doesn't, I'd like to have some visual confirming the current selection is in clipboard (if it is), such as selection outline color. But that's another pr/issue, right? |
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.
- we need to not allow a click to select a single character
- look at how other terminals fix that
I agree with dustin on the whole "we need to not allow a click to select a single character" thing
Yeah. I originally had it disappear to provide feedback that you copied it. I'm going to change it to:
|
Question: should setting be renamed to |
I think I personally prefer |
A copyMode of "unix" is pretty ambiguous, IMO it could just as easily refer to line ending conversion as it could to the select/click behaviour. Also, AFAIK (grumpy old man tone) copy-on-select derives more from X and its ancestors than it does Unix. |
CopyOnSelect value accessible through Terminal's IsCopyOnSelectActive
Alright, decided on the following model for the settings:
The only tricky part I see here is |
Significant changes.
// - Checks if selection on a single cell is allowed for rendering purposes | ||
// Return Value: | ||
// - bool representing if selection is only a single cell. Used for copyOnSelect | ||
const bool Terminal::IsSingleCellCopyAllowed() const noexcept |
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.
can this and the above be folded into IsSelectionActive
?
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.
this one can be deleted once the TermControl caller goes away
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.
I'm of two minds:
- I want to ship this feature
- I want tests
I'm not approving, but only based on the fact there aren't any tests in a very testable part of the code. The other two can get together and override me though if they want.
# Conflicts: # src/cascadia/TerminalCore/Terminal.hpp # src/cascadia/UnitTests_TerminalCore/ScreenSizeLimitsTest.cpp
This comment has been minimized.
This comment has been minimized.
@zadjii-msft CopyOnSelect tests got added. Note that an "active selection" is considered copy-able. Handling a single cell selection is really weird but I thing the refactor and the test should make it clear what kind of behavior is now expected when using this new mode. |
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 for adding the tests C:
@msftbot make sure @DHowett-MSFT signs off |
Hello @carlos-zamora! Because you've given me some instructions on how to help merge this pull request, I'll be modifying my merge approach. Here's how I understand your requirements for merging this pull request:
If this doesn't seem right to you, you can tell me to cancel these instructions and use the auto-merge policy that has been configured for this repository. Try telling me "forget everything I just told you". |
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.
Minor nits, but I'd like to see them answered before the bot merges the PR ;)
// - Checks if selection on a single cell is allowed for rendering purposes | ||
// Return Value: | ||
// - bool representing if selection is only a single cell. Used for copyOnSelect | ||
const bool Terminal::IsSingleCellCopyAllowed() const noexcept |
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.
this one can be deleted once the TermControl caller goes away
I'm running the version in the store. (0.3.2171.0) With this version, click-drag, double-click and triple-click all select and copy to clipboard. Right click removes selection, but does NOT paste. A second right click DOES paste. This is odd. On other terminal apps on windows and Linux, middle button is paste and right button is menu. Is there an option to get that functionality? What does middle button do currently? I don't see a "CopyOnSelect" option in settings. |
As of 0.3.2171.0: selection just selects, right-click copies and deselects, and then right-click pastes. |
I didn't expect it to be in the store release yet, just being clear that I'm not yet testing the current change. :) I would like to see more Linux-y feel with left button select modes, middle button paste mode, and right button menu. It's been requested before on other posts. I was just wondering if there's a plan for adding that. Thanks for the updates! |
Thanks! We haven't yet looked at middle-paste, but we've talked about "mouse bindings" (as a post-1.0 feature)! |
🎉 Handy links: |
Question: I'm using 0.4.2382.0 but I am still having big issues when using I am just trying to fix the annoying bug of copying something in my clipboard [from e.g. the notepad or the browser] and then pasting it in my |
@alecive what you have described is not a bug (???) so we can't tell if this pull request, which adds an option that makes it so text you select gets copied to the clipboard automatically, fixes it. (fwiw: add |
Awesome!!!! |
Summary of the Pull Request
Introduces the "copyOnSelect" setting to "globals" as a boolean type. When set to
true
, a selection is immediately copied to your clipboard upon creation. When set tofalse
, the selection persists and awaits further action.PR Checklist
added/passednot necessaryDetailed Description of the Pull Request / Additional comments
Standard "added a new global setting" changes
TermControl
'sPointerReleased
event is updated to support a mouse button release event. Just hooked up the copy function right there.Validation Steps Performed
copyOnSelect
= truecopyOnSelect
= truecopyOnSelect
= truecopyOnSelect
= false