Skip to content
This repository has been archived by the owner on Apr 1, 2020. It is now read-only.

Can't type square brackets [ ] #644

Open
gr7ffo opened this issue Aug 22, 2017 · 18 comments
Open

Can't type square brackets [ ] #644

gr7ffo opened this issue Aug 22, 2017 · 18 comments

Comments

@gr7ffo
Copy link

gr7ffo commented Aug 22, 2017

For some reason I can't type square brackets using Oni 0.2.8 on Windows 7.
The input works on any other window, just inside Oni it does not work.
It only switches from insert to normal mode when I try to type [.
When typing ] Oni does nothing.

I use the standard german keyboard layout (in Neovim without Oni everything works fine).

I am currently not using a custom init.vim, my config.js looks like this

module.exports = {
  //add custom config here, such as
  "oni.useDefaultConfig": true,
  "oni.loadInitVim": false,
  "oni.hideMenu": true,
  "editor.fontSize": "14px",
  "editor.fontFamily": "Roboto Mono"
}
@bryphe bryphe added this to the 0.3 milestone Aug 22, 2017
@bryphe
Copy link
Member

bryphe commented Aug 22, 2017

Thanks for logging the issue, @Balagrio , and all the details. I'm guessing it is related to some difference in the german keyboard layout. I think this is an issue with the mapping / conversion logic in Keyboard.ts - perhaps it is mistaking the [ keycode for Escape.

@justjoeyuk
Copy link
Contributor

@extr0py I don't think so. The global code for ESC is 27, which is the keycode mapping. I tried doing a German keyboard layout and testing different representation of the keycode in JS. It all printed out as ESC being pressed. Can't really see a solid solution.

@ioncodes
Copy link

I'm expiriencing this too. Same problem happens when I paste text while in Insert mode. Maybe it doesn't handle CRLF/LF correctly?

@bryphe
Copy link
Member

bryphe commented Sep 2, 2017

I think this is because we aren't handling the AltGr key correctly - depending on the platform it either comes to our input layer as C+[ or C+A+[, so we need to handle this case.

@riedel
Copy link

riedel commented Sep 23, 2017

I do not quite get the root of the problem. On the german keyboard {[]}\ are AltGr combinations of 7890. Interestingly {} work (!), but not []\ which all emit the '^' escape sequence of ESC, so what is the difference here? BTW also | and '~' work, but not ²³. Trying to type e.g. latex without []\ on a German keyboard is pretty much a show stopper.

@bryphe
Copy link
Member

bryphe commented Oct 3, 2017

This was fixed in PR #717 (which is in the v0.2.10 release), the AltGr keys should behave as expected now for German keyboards. I'll close this, but let me know if you're still seeing any issues.

@bryphe bryphe closed this as completed Oct 3, 2017
@nikonakoneko
Copy link

Hi, I just tried right now with the v0.2.11 release on a laptop with windows 10 and a spanish keyword. I can't type the opening square bracket ([), but I can type the closing one normaly.

How could I help, get the key code or so?

@bryphe bryphe reopened this Oct 5, 2017
@bryphe
Copy link
Member

bryphe commented Oct 6, 2017

Hi @soratobukuroneko,

Thanks for reporting the issue! I was able to repro on my Win 10 machine with spanish keyboard.

You can see the key resolution in the console by running the command Oni.log.enableVerboseLogging():
image

It looks like, in this case, the BracketLeft is getting resolved as <Control+Alt+[> instead of [ as we'd expect. The BracketRight shows a correct resolution of ].

We use the keyboard-layout module to help resolve the characters - it provides a keymap that tells us how a character resolves.

Somehow, it´s not providing a resolution for BracketLeft:
image

I'll log an issue on the keyboard-layout repo to track - in the meantime, we could probably hack this by hardcoding the resolution for the case where we're on windows and using the es-ES keyboard language. I just hope there aren't many more of these gaps!

@bryphe
Copy link
Member

bryphe commented Oct 6, 2017

Logged an issue at atom/keyboard-layout#36 to track. In the meantime, I'll fix this locally by special casing this.

bryphe added a commit that referenced this issue Oct 7, 2017
* Add quick fix for BracketLeft issue

* Fix lint issue
@bryphe
Copy link
Member

bryphe commented Oct 10, 2017

FYI @soratobukuroneko - The fix for this is in the latest build - v0.2.12. Feel free to open a new issue if there are any other keyboard-layout problems - we may need to generalize the 'hack' here.

@bryphe bryphe closed this as completed Oct 10, 2017
@nikonakoneko
Copy link

I tried the v0.2.12 release and the "1.0.256" build from appveyor but the opening bracket keep getting resolved to <c-a-[> instead of BracketLeft

@MatonAnthony
Copy link

Hello,

On Windows 7 with a Belgian Layout this problem is still present.
Is there a fix, I could use?

@Julien00859
Copy link

Up. Same problem on the Belgian layout on Windows 10

@badosu badosu reopened this Apr 16, 2018
@badosu
Copy link
Collaborator

badosu commented Apr 16, 2018

@MatonAnthony @Julien00859 Can you post the output of the Dev Console as outlined by @bryphe above? Are you using 0.3.2?

@DeltaEvo
Copy link
Contributor

DeltaEvo commented Apr 16, 2018

@badosu it seems that @bryphe only fixed this for es-ES layout d5d1d2d, i think to make the fix for everyone we can define it when it's not defined, what do you think @bryphe ?

@Julien00859
Copy link

Julien00859 commented Apr 16, 2018

Problem is I have no [Key event] showing in the console (Oni.log.enableVerboseLogging() called)

Oni.log.enableVerboseLogging()
undefined
bundle.js:1 [REDUX - NeovimEditor0][ACTION] SET_CURSOR_SCALE
bundle.js:1 [REDUX - NeovimEditor0][ACTION] SET_WINDOW_CURSOR
bundle.js:1 [SyntaxHighlighting.notifyViewportChanged] - bufferId: 1 topLineInView: 0 bottomLineInView: 0
bundle.js:1 [REDUX - NeovimEditor0][ACTION] SET_MODE
bundle.js:1 [REDUX - LANGUAGE][ACTION] MODE_CHANGED
bundle.js:1 [REDUX - NeovimEditor0][ACTION] undefined
bundle.js:1 [REDUX - NeovimEditor0][ACTION] SET_CURSOR_POSITION
bundle.js:1 [REDUX - COMPLETION_STORE][ACTION] CURSOR_MOVED
bundle.js:1 [REDUX - COMPLETION_STORE][ACTION] MODE_CHANGED
bundle.js:1 [REDUX - CONTEXT-MENU][ACTION] undefined
bundle.js:1 [REDUX - NeovimEditor0][ACTION] BUFFER_UPDATE
bundle.js:1 [REDUX - SyntaxHighlighting][ACTION] SYNTAX_UPDATE_BUFFER
bundle.js:1 [REDUX - Shell][ACTION] undefined
bundle.js:1 [REDUX - Shell][ACTION] STATUSBAR_SHOW
bundle.js:1 [REDUX - COMPLETION_STORE][ACTION] null
bundle.js:1 [REDUX - CONTEXT-MENU][ACTION] undefined
bundle.js:1 [REDUX - NeovimEditor0][ACTION] SET_CURSOR_SCALE
3bundle.js:1 [REDUX - NeovimEditor0][ACTION] SET_CURSOR_SCALE
bundle.js:1 [REDUX - NeovimEditor0][ACTION] SET_WINDOW_CURSOR
bundle.js:1 [SyntaxHighlighting.notifyViewportChanged] - bufferId: 1 topLineInView: 0 bottomLineInView: 0
bundle.js:1 [REDUX - NeovimEditor0][ACTION] HIDE_TOOL_TIP
bundle.js:1 [REDUX - NeovimEditor0][ACTION] SET_MODE
bundle.js:1 [REDUX - COMPLETION_STORE][ACTION] MODE_CHANGED
bundle.js:1 [REDUX - LANGUAGE][ACTION] MODE_CHANGED
bundle.js:1 [REDUX - NeovimEditor0][ACTION] undefined
bundle.js:1 [REDUX - NeovimEditor0][ACTION] SET_CURSOR_POSITION
bundle.js:1 [REDUX - CONTEXT-MENU][ACTION] undefined
bundle.js:1 [REDUX - Shell][ACTION] undefined
bundle.js:1 [REDUX - Shell][ACTION] STATUSBAR_SHOW
3bundle.js:1 [REDUX - NeovimEditor0][ACTION] SET_CURSOR_SCALE
bundle.js:1 [OniEditor::leave]
bundle.js:1 [NeovimEditor::leave]

Was in command mode
Keys pressed: i[

Edit: running version 0.3.2

@DeltaEvo
Copy link
Contributor

@Julien00859 the key events seems logged with debug log level so try using Oni.log.enableDebugLogging()

@Julien00859
Copy link

Indeed

[Key event] Code: BracketLeft Key: [ CtrlKey: true ShiftKey: false AltKey: true | Resolution: <a-c-[>

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

10 participants