Skip to content
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

[terminal] (⌘K) was pressed. Waiting for second key of chord... #7240

Closed
prashaantt opened this issue Jun 6, 2016 · 9 comments
Closed
Assignees
Labels
*duplicate Issue identified as a duplicate of another issue(s) feature-request Request for new features or functionality macos Issues with VS Code on MAC/OS X terminal Integrated terminal issues upstream Issue identified as 'upstream' component related (exists outside of VS Code)
Milestone

Comments

@prashaantt
Copy link

  • VSCode Version: 1.2.0-insider
  • OS Version: OS X 10.11.5

Steps to Reproduce:

  1. Press ⌘K to clear the integrated terminal.
  2. The terminal gets cleared.
  3. VS Code is still waiting for the second key of the ⌘K chord.

⌘K is a recognised shortcut for clearing out the terminal on the Mac, but here it also conflicts with Code's other key bindings.

@Tyriar
Copy link
Member

Tyriar commented Jun 7, 2016

I don't think ⌘K would be a good default because it would conflict with the chord keybindings. I'm going to close this off as a duplicate of #6603 which will allow you to set your own keybinding for clearing the terminal.

@Tyriar Tyriar closed this as completed Jun 7, 2016
@Merott
Copy link

Merott commented Jun 7, 2016

@Tyriar I'm so used to the ⌘K shortcut to clear the terminal on Mac, that I do it automatically without thinking. And I do it a lot.

The ⌘K combination is even recognised in the Chrome DevTools Console for clearing the output - yet another reason that I'm so used to it.

I realise I may not be alone in this, so I have a suggestion:

  • As per your suggestion, set the default "Clear Terminal" shortcut to something that won't conflict with another shortcut, especially the chord keybindings.
  • If the user decides to override the default shortcut with ⌘K, make sure that VSCode does not consider that as initiation of a chord keybinding.

This way, there won't be a conflict by default, but the user can opt to lose chord keybindings when in the context of the terminal, in favour of using the well-recognised shortcut.

Would you mind to reopen the issue to make it easier to find, and to continue the discussion?

@prashaantt
Copy link
Author

prashaantt commented Jun 7, 2016

Thanks @Merott for chiming in. I use ⌘K very heavily too.

I would love to take this discussion to a point where it might be possible to detach the default bindings whenever the terminal is in focus (except perhaps one shortcut to focus back on the workbench) and only retain the platform-level shortcuts that deal specifically with the terminal. I'm not sure if that's possible, but I suppose that would be most ideal.

@Tyriar
Copy link
Member

Tyriar commented Jun 7, 2016

I can definitely sympathize, I'm not going to be happy unless I copy and paste in the terminal using ctrl+shift+c and ctrl+shift+v for example.

I'm not sure how the chord keybindings work exactly and what can override them, but there are conditions you can attach to keybindings, for example:

{ "key": "escape",                "command": "cancelSelection",
                                     "when": "editorHasSelection && editorTextFocus" },

A terminalFocus value seems like an ideal usage of the when property.

You can also unbind keybindings as of v1.2.0 which is another possible remedy.

So it's not possible right now to bind anything to ⌘K?

@Tyriar Tyriar reopened this Jun 7, 2016
@Tyriar Tyriar added the feature-request Request for new features or functionality label Jun 7, 2016
@Tyriar Tyriar self-assigned this Jun 7, 2016
@Tyriar Tyriar added the terminal Integrated terminal issues label Jun 7, 2016
@Merott
Copy link

Merott commented Jun 7, 2016

@prashaantt - I came to Github the log this issue myself, but I found this one 👍 - It shouldn't be necessary to disable all keybindings in terminal. In fact, I wouldn't want that.

This can really be simplified to changing the behaviour of the ⌘K shortcut, to not initiate chord keybindings if it gets used as a normal shortcut. Then, the user can do this:

{
    "key": "cmd+k",
    "command": "terminal.action.clear",  // does not exist today
    "when": "terminalFocus"              // does not exist today
  }

With the updated ⌘K behaviour, the above would work just as you'd expect, and only in the context of the terminal. If you leave out the when property, your ⌘K chord bindings will stop altogether. It's not wise, but it's a choice.

Thanks @Tyriar for reopening the issue. And to answer your question, it seems that as of right now, ⌘K can't be used as a keyboard shortcut, so the above would not be possible yet.

@Tyriar
Copy link
Member

Tyriar commented Jul 5, 2016

Upstream issue: xtermjs/xterm.js#118

@Tyriar Tyriar added upstream Issue identified as 'upstream' component related (exists outside of VS Code) macos Issues with VS Code on MAC/OS X labels Jul 5, 2016
@jensvdh
Copy link

jensvdh commented Jul 8, 2016

Any of idea of what it would take to implement a "terminalFocus" when condition? Would love to contribute to get this issue solved. I hit cmd+k quite a lot out of habit!

@Tyriar
Copy link
Member

Tyriar commented Jul 8, 2016

@jensvdh xtermjs/xterm.js#118 will probably fix the issue without requiring a terminalFocus event, I'm hoping to get this done for July.

@Tyriar Tyriar added this to the July 2016 milestone Jul 8, 2016
@Tyriar Tyriar modified the milestones: August 2016, July 2016 Jul 21, 2016
@Tyriar Tyriar modified the milestones: Backlog, August 2016 Aug 10, 2016
@Tyriar
Copy link
Member

Tyriar commented Sep 6, 2016

Closing in favor of #6603

@Tyriar Tyriar closed this as completed Sep 6, 2016
@Tyriar Tyriar added the *duplicate Issue identified as a duplicate of another issue(s) label Sep 6, 2016
@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*duplicate Issue identified as a duplicate of another issue(s) feature-request Request for new features or functionality macos Issues with VS Code on MAC/OS X terminal Integrated terminal issues upstream Issue identified as 'upstream' component related (exists outside of VS Code)
Projects
None yet
Development

No branches or pull requests

4 participants