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

Press BracketLeft to find in explorer and shows Dead #80741

Closed
narcello opened this issue Sep 11, 2019 · 10 comments · Fixed by #82972
Closed

Press BracketLeft to find in explorer and shows Dead #80741

narcello opened this issue Sep 11, 2019 · 10 comments · Fixed by #82972
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug good first issue Issues identified as good for first-time contributors help wanted Issues identified as good community contribution opportunities tree-widget Tree widget issues verified Verification succeeded
Milestone

Comments

@narcello
Copy link

  • VSCode Version: 1.38.0
  • OS Version: Linux x64 4.15.0-29deepin-generic

Steps to Reproduce:

  1. Put focus on explorer section
  2. Type BracketLeft, key code 219

dead

Does this issue occur when all extensions are disabled?: Yes

@narcello narcello changed the title Press BracketLeft to find in explorer and show Dead Press BracketLeft to find in explorer and shows Dead Sep 11, 2019
@joaomoreno joaomoreno added this to the September 2019 milestone Sep 13, 2019
@joaomoreno joaomoreno added bug Issue identified by VS Code Team member as probable bug tree-widget Tree widget issues labels Sep 13, 2019
@joaomoreno joaomoreno removed this from the September 2019 milestone Sep 13, 2019
@joaomoreno joaomoreno added good first issue Issues identified as good for first-time contributors help wanted Issues identified as good community contribution opportunities labels Sep 13, 2019
@kevinunger
Copy link

Cannot reproduce

  • VSCode Version: 1.38.0
  • OS Version: macOS 10.14.6 (18G95)

@aganglada
Copy link

Cannot reproduce either

  • VSCode Version: 1.39.0
  • OS Version: macOS 10.14.2

@joaomoreno
Copy link
Member

@MarcelloVSilva Do you maybe have a special keyboard layout?

@narcello
Copy link
Author

No, i have a Dell Inspiron 14 5480 and i use his keyboard, i check again and the error stills here. Not just for BracketLeft, but shows the same error when i press Quote. I tested with external keyboard and i have same results.

Version: 1.38.1
Commit: b37e54c98e1a74ba89e03073e5a3761284e3ffb0
Date: 2019-09-11T13:30:08.229Z
Electron: 4.2.10
Chrome: 69.0.3497.128
Node.js: 10.11.0
V8: 6.9.427.31-electron.0
OS: Linux x64 4.15.0-29deepin-generic

Keys:
WhatsApp Image 2019-09-23 at 20 33 59

@kevinunger
Copy link

Ok, I can reproduce it now on MacOS & Windows with english and german layout, but BracketLeft works.
What kind of keyboard layout do you use @MarcelloVSilva, Portuguese layout?
Maybe this is related: Issue

When pressing a modifier key, the key event listener returns 'DEAD', this is normal, but should not be printed to the user. The modifier key is applied. So when I press ' ^ ' then ' a', it shows ' â '. vscode should check the return value of the key event listener and filter out 'DEAD'.
Modifier keys that result in 'DEAD' :

  • ^
  • `
  • ´

@narcello
Copy link
Author

narcello commented Sep 24, 2019

Yeah, i use portuguese layout keyboard. With us layout doesn't have a problem.

  • ^
  • `
  • ´
    All ocurrencies prints Dead

@ghost
Copy link

ghost commented Oct 4, 2019

I'm using portuguese layout keyboard as well.

  • ^
  • ´
  • `
  • ~

All of these keys prints Dead

@IBRAHIM-HAMZA
Copy link

I'm using portuguese layout keyboard as well.

  • ^

  • ´

@frobinsonj
Copy link
Contributor

frobinsonj commented Oct 20, 2019

@joaomoreno I'd be interested in taking a look at this if that's okay.

I've found

private onEventOrInput(e: MouseEvent | StandardKeyboardEvent | string): void {
if (typeof e === 'string') {
this.onInput(e);
} else if (e instanceof MouseEvent || e.keyCode === KeyCode.Escape || (e.keyCode === KeyCode.Backspace && (isMacintosh ? e.altKey : e.ctrlKey))) {
this.onInput('');
} else if (e.keyCode === KeyCode.Backspace) {
this.onInput(this.pattern.length === 0 ? '' : this.pattern.substr(0, this.pattern.length - 1));
} else {
this.onInput(this.pattern + e.browserEvent.key);
}
}

The obvious fix here is to amend L699 to include a check for dead keys, however, this seems a bit hacky as onEventOrInput() will still be called. Is there somewhere else that this could be handled?

private onEventOrInput(e: MouseEvent | StandardKeyboardEvent | string): void {
	if (typeof e === 'string') {
		this.onInput(e);
	} else if (e instanceof MouseEvent || e.keyCode === KeyCode.Escape || (e.keyCode === KeyCode.Backspace && (isMacintosh ? e.altKey : e.ctrlKey))) {
		this.onInput('');
	} else if (e.keyCode === KeyCode.Backspace) {
		this.onInput(this.pattern.length === 0 ? '' : this.pattern.substr(0, this.pattern.length - 1));
	} else if (e.browserEvent.key !== 'Dead') {
		this.onInput(this.pattern + e.browserEvent.key);
	}
}

EDIT:
Could instead modify onKeyDown (a bit nicer)

const onKeyDown = Event.chain(domEvent(this.view.getHTMLElement(), 'keydown'))
.filter(e => !isInputElement(e.target as HTMLElement) || e.target === this.filterOnTypeDomNode)
.map(e => new StandardKeyboardEvent(e))
.filter(this.keyboardNavigationEventFilter || (() => true))
.filter(() => this.automaticKeyboardNavigation || this.triggered)
.filter(e => this.keyboardNavigationDelegate.mightProducePrintableCharacter(e) || ((this.pattern.length > 0 || this.triggered) && ((e.keyCode === KeyCode.Escape || e.keyCode === KeyCode.Backspace) && !e.altKey && !e.ctrlKey && !e.metaKey) || (e.keyCode === KeyCode.Backspace && (isMacintosh ? (e.altKey && !e.metaKey) : e.ctrlKey) && !e.shiftKey)))
.forEach(e => { e.stopPropagation(); e.preventDefault(); })
.event;

But this still isn't ideal, as it doesn't behave the same as all other inputs. Bit lost here to be honest and would appreciate any pointers.

@joaomoreno
Copy link
Member

@frobinsonj I think the best we can do is exactly what you've done with !== 'Dead'. Feel free to submit a PR!

frobinsonj added a commit to frobinsonj/vscode that referenced this issue Oct 21, 2019
@joaomoreno joaomoreno added this to the October 2019 milestone Oct 21, 2019
@JacksonKearl JacksonKearl added the verified Verification succeeded label Oct 30, 2019
@vscodebot vscodebot bot locked and limited conversation to collaborators Dec 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug good first issue Issues identified as good for first-time contributors help wanted Issues identified as good community contribution opportunities tree-widget Tree widget issues verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants