-
Notifications
You must be signed in to change notification settings - Fork 337
Locali(s)(z)ed keyboard support for 3rd level characters #5
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
Conversation
src/term.js
Outdated
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.
This looks like a typo, and that it should be "else if".
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.
Tested with "else if" and it did not work.
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.
It will not work with "else if" - with the current implementation it needs to be always executed if the condition is true. Otherwise the execution stops in one of the previous else ifs. For example @ line 2599:
} else if ((!this.isMac && ev.altKey) || (this.isMac && ev.metaKey)) {
What platform, browser and which kbLayout are you testing out with, other than ee you will only receive 'Not implemented' in your browser log.
|
Nice. This estonian implementation works also for finnish keyboard layout. Maybe swedish too. |
|
Oh didn't see this comment, glad it works for fi. You can add the fi and se country codes as well - glad that someone can test this patch! |
|
to be honest there is a de-latin1-nodeadkeys layout in arch linux. using it will bind third level characters to every key |
|
@GottZ - Curious, what did you mean by that comment, a missing placeholder? This is true, the implementation I wrote is "ee" specific as it was the only layout I could reliably test, I added the placeholders for only the specific layouts I had knowledge of at the time. As it hasn't been merged by the original author I'm still using it as a hack - maybe there's a more elegant way in getting the 3rd level characters to work.. |
|
well i mean, as soon as i type and kind of altgr + key combination the char will not be visible. if i can find some time i'd be happy to create a commit to fix this issue global. i've got an idea that might work without breaking anything. |
|
This patch already fixes that and should work for you as well as soon as you add your country specific mappings. 3rd level mappings differ from country to country so the same key combination or code is used to represent different characters: German: http://en.wikipedia.org/wiki/AltGr_key#German There are of course similarities so you can even try this patch without modification, use the 'ee' layout and in your keyboard the Altgr+7, Altgr+8, Altgr+9, Altgr+0 should map correctly to your layout and the character should be visible. In terms of a global fix, one would probably need to use keypress event instead of keydown to get directly the actual character that the OS/Keyboard is mapping to, making the kbLayout parameter obsolete but requires a bigger rewrite. The mapping you are using from OS does not matter to term.js or Javascript. Because the keyDown event is oblivious to the keyboard mapping in use. |
|
hm. by digging deeper into the solution i have in mind i noticed it would only work in webkit.. there is a textinput event that is getting fired if keydown / keyup dont get prevented. however as i said.. that would only work in webkit. still worth implementing i think because it would make key maps obsolete. |
|
Not sure about the "worth" part. textinput event is scoped and only fired in certain elements (might be wrong here..) and you'll have issues getting the other keys like up-down arrows and such to work plus you'd need to change the UI side of things. However, If you do get it to work, yes, you'd be free of the mappings! 👍 Not trying to discourage you, btw! If you get it to work I'm always up to trying the patch out! Apart from defining the maps, which is a one time effort, there's no bigger re-write of anything else with my approach - it simply works and that was the original appeal to me :) Let's face it, it seems to be serving only "minority" interests here. I'm not sure if it's ever going to be pulled in or what the maintainer thinks of this patch as he hasn't commented on it 🎱 |
|
@chjj any comments on this one? It shouldn't break anything for people using default us keyboard and merging this would enable me to consume upstream 👀 Other more exotic kbLayouts can be added as needed... |
|
I tried to handle the issue by hidden textarea (Especially Japanese for me) |
|
A worthy fork that seems to be moving on and welcoming your patches exists in https://github.com/sourcelair/xterm.js, maintained by @parisk. |
|
@rgbkrk Thanks, I'll check it out! |
|
@exsilium we would be happy to work with you on this at xterm.js, where we have an open issue that seems to match this PR (xtermjs/xterm.js#33). Thanks for the mention @rgbkrk. |
This patch includes support-beginnings for locali(s)(z)ation needed by countries where keyboard includes third-level characters.
Characters like @|{[]}\ are currently often not usable because they are mapped as 3rd level characters on different international keyboard layouts.
- kbLayout option introduced, which can be given during Terminal.call and changed even after, defaults to 'us';
- Placeholders for the following layouts:
-> French (fr);
-> German (de);
-> UK (uk);
-> South Slavic Latin countries - Croatia (hr),Slovenia (si), Bosnia and Herzegovina (ba), Serbia (rs);
-> Belgium (be);
-> Polish (pl);
-> Turkish (tr);
- Placeholder keyboard layouts currently output "Not Implemented" to browser console;
- Estonian keyboard layout implementation for Windows (AltGr) and Mac (Alt);
- Should not break anything that was working before...
This reverts commit 6b90512.
- 3rd level characters now work; - Special character input via composition events work; - Different set of fixes and improvements from xterm.js
- Textarea id introduced so that the element can be addressed from the application level. - PuTTY-style copy-paste implemented in cloud9 terminal side. This is an application level feature which is unsuitable to be done directly in term.js.
- Cmd-V on mac - Ctrl-V elsewhere - Aims to fix one of the issues reported in pylonide/pylon#21
|
We've all moved over to https://github.com/xtermjs/xterm.js and this project is no longer maintained. Closing this PR and cleaning up. 📯 🚀 |
This patch includes support-beginnings for locali(s)(z)ation needed by countries where keyboard includes third-level characters.
Characters like @|{[]}\ are currently often not usable because they are mapped as 3rd level characters on different international keyboard layouts.
-> French (fr);
-> German (de);
-> UK (uk);
-> South Slavic Latin countries - Croatia (hr),Slovenia (si), Bosnia and Herzegovina (ba), Serbia (rs);
-> Belgium (be);
-> Polish (pl);
-> Turkish (tr);
This patch will hopefully pave way for others to include their specific country layouts and solve issues like reported here: chjj/tty.js#64