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

Holding down a key only sends a single key on Mac #265

Closed
Tyriar opened this issue Sep 6, 2016 · 12 comments
Closed

Holding down a key only sends a single key on Mac #265

Tyriar opened this issue Sep 6, 2016 · 12 comments
Labels
platform/macos type/bug Something is misbehaving
Milestone

Comments

@Tyriar
Copy link
Member

Tyriar commented Sep 6, 2016

Original issue: microsoft/vscode#10398
Does not reproduce on Ubuntu 16.04

Details

  • Browser and browser version: vscode/electron (Chrome v49)
  • OS version: OS X
  • xterm.js version: 220828f

Steps to reproduce

  1. npm start
  2. Focus terminal and hold the a key, only a single character is added to the prompt
@Tyriar
Copy link
Member Author

Tyriar commented Sep 7, 2016

Oh apparently this is standard across Mac applications

@Tyriar Tyriar closed this as completed Sep 7, 2016
@parisk
Copy link
Contributor

parisk commented Sep 8, 2016

Yep, that's true. Even on native text areas in browser.

We could create an add-on though to handle this, since the native terminal on OS X sends repeated keypress events.

@Tyriar
Copy link
Member Author

Tyriar commented Nov 29, 2016

I think we should support this out of the box like the default terminal on Mac does.

@kaiwood
Copy link

kaiwood commented Nov 30, 2016

Just dumping some initial thoughts on this, because I did a little research…

Terminal.app seems to not do anything special, it repeats every key that has no accented characters associated (- repeats, o does not):

terminal_keyrepeat

My first thought was, that its not possible to work around this, as it's a OS feature that can only be disabled global for all applications by the user or as a default setting in the applications .plist. JavaScript has no ability control this, in the case of VSCode this would need to be set somewhere in Electron.

BUT:

As it turns out, the browser receives the key event repeatedly even if the popup for the accented characters appears (tested on http://unixpapa.com/js/testkey.html):

keyevent_tester_keyrepeat

Although a little hackish, it might be possible to just listen to event, take the charcode (only accessible on the first event that gets fired, not sure why) from it and append it somehow back via String.fromCharCode.

The now still visible popup would be annoying, but it looks like it gets swallowed by xterm anyway, in the browser as well as inside VSCode:

xterm_keyrepeat

@willkessler
Copy link

Was there ever any forward activity on this bug? We really feel that key-repeat in a terminal is sort of a crucial function, as in iTerm, Terminal.app, etc.

Perhaps an addon exists that didn't make it to this thread? Thanks very much!

@Tyriar
Copy link
Member Author

Tyriar commented May 26, 2017

I know the reason for this now; it happens because we're listening to keydown and keypress, not input which throws these repeated char events. We will also need to use input for proper emoji support on macOS #469

@willkessler
Copy link

Is a fix on your radar, would you say? 👍

@Tyriar
Copy link
Member Author

Tyriar commented May 26, 2017

On radar yes, it's a blocker for Hyper to move over to xterm.js

@willkessler
Copy link

What's Hyper?

@Tyriar
Copy link
Member Author

Tyriar commented May 26, 2017

A terminal emulator that is considering moving over: https://hyper.is/

@willkessler
Copy link

Ah I thought maybe you meant that one. Have been using it on and off for the past year. Love the sparkles effect trail as you type! :-)

So that means everything should work fine in Electron?

@Tyriar
Copy link
Member Author

Tyriar commented May 26, 2017

@willkessler I embed xterm.js in VS Code which is also an Electron app, works great 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform/macos type/bug Something is misbehaving
Projects
None yet
Development

No branches or pull requests

4 participants