-
Notifications
You must be signed in to change notification settings - Fork 8.5k
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
Connect clipboard functionality to their keybindings #1093
Connect clipboard functionality to their keybindings #1093
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.
The other major change is that we need to make sure the VT sequences for these keybindings go through to the terminal. This is important because in CMD, CTRL+C stops the output. So if we prevent that from coming in, we're gonna be creating a MASSIVE bug :(. Not sure if this got resolved by the PR adding keybindings to the settings.
Right-click checks for shift and toggles the copy mode. If we implement a toggle key for the keyboard shortcut, one of the following happens:
So I think the best (or, at a minimum, "least bad") solution here is to add a separate keybinding for whitespace-preserving copy. I'm also unclear how much actual use this whitespace-preserving copy sees. Regarding passing ctrl-c to the terminal in all cases... that's not really appropriate to clipboard stuff per se, and should be handled generically in the keybinding code. But in any case, I'd hope the default keybinding for copy is ctrl+ins or ctrl+shift+c precisely because (in my opinion) there is no elegant handling for copy being ctrl+c anyway -- you either cannot send a ^C to the terminal, or you are forced to do so when copying to the clipboard from the keyboard... |
This seems fine to me for now - it doesn't add a default keybinding for these, so we can discuss that later (though I think we're all pretty highly in favor of ctrl+shift+c/v). I think we can discuss the potential for adding a non-trimming copy keybinding later |
Hmm... well, SHIFT serves as a modifier to a classic copy. So I guess this is more of a discussion of "should modifiers be rebindable (and how to represent that)". In that case, let's just hard-code SHIFT like we did with mouse selection copy/paste. That way that feature is still in. You can take a look at |
Do you mean in the right-click copy, or for any copy key binding? If the latter, the "standard" copy key binding of ctrl-shift-c (per @zadjii-msft above) doesn't function correctly. I don't think using hard-coded modifiers on bindable keys is a good idea for that reason. And if there's only one shortcut affected by the modifier, implementing it as a bindable modifier is kinda pointless. |
Well, the current behavior for non-Windows Terminal is (in pseudocode):
So I think I just figured out how we can get around this issue. We'll have to do that check when we commit that action in |
Yeah. So then let's not worry about making the modifier re-bindable. But would you be able to figure out how to detect if the SHIFT key was pressed so that we can pass that in to the After that, we should be good. 😊 |
I can do that, but that literally breaks the keybinding, since you could no longer bind whitespace-trimming copy to ctrl-shift-c. Can we do it in a way that actually allows whitespace-trimming copy to be able to be bound to ctrl-shift-c? |
Ok. Sorry. I've been jumping around all day. Just talked it over with @DHowett-MSFT and @zadjii-msft. Here's the plan:
That way, that specific action can be bindable and we can get both functionalities in. If you feel comfortable working on it, add it in. If not, let me know and I can just add it in after this PR goes in 😊 Up to you |
I can get that this evening. |
Ok, "copyTextWithoutNewlines" option added. Is it safe to add ctrl+shift+c/ctrl+shift+v as defaults for copy (with newlines) and paste? |
Awesome! Thanks! Go for it. That shouldn't interfere with passing the |
…l-shift-v, respectively.
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.
Just fix the "Terminal CI (Static Analysis Build x64)" and it should be good: |
Got it. |
* Connects clipboard functionality to their keybindings. * Cleaning up comments and whitespace. * Added "copyTextWithoutNewlines" keybinding. * Fixing tabs in idl file * Fixing merge conflicts * Adding default keybindings for copy and paste to ctrl-shift-c and ctrl-shift-v, respectively. * Complying with refactoring * Fixing formatting issues
* Connects clipboard functionality to their keybindings. * Cleaning up comments and whitespace. * Added "copyTextWithoutNewlines" keybinding. * Fixing tabs in idl file * Fixing merge conflicts * Adding default keybindings for copy and paste to ctrl-shift-c and ctrl-shift-v, respectively. * Complying with refactoring * Fixing formatting issues
🎉 Handy links: |
Summary of the Pull Request
Connects copy and paste keybindings to the appropriate clipboard functionality within Terminal.
References
#1072, #968
PR Checklist
Detailed Description of the Pull Request / Additional comments
Changes:
Notes: