FXMisc / RichTextFX

Rich-text area for JavaFX
BSD 2-Clause "Simplified" License
1.21k stars 236 forks source link

Bug: Tilde is not shown as single character on Mac #929

Open Roel541 opened 4 years ago

Roel541 commented 4 years ago

The tilde character is only shown after pressing a subsequent char on Mac. It is interpretended as Dead-Tilde. On Linux and Windows the character is shown immediatly after pressing the key (Alt Gr +) In the ohter JavaFx controls as Textfield, '~' is shown immediatly , also on Mac. Language and keyboard-layout are German.

Roel541 commented 4 years ago

I've made a project with a Textfield and a GenericStyledArea. Then attached a EventFilter for KeyEvent.ANY and launched it on Windows and Mac On a Mac, the behaviour is different in a Textfield and a GenericStyledArea Control

Logging KeyEvents Results Windows: TextField -> type "\~" EvenType, char, textText, code.getname, alt, ctrl, shift,meta,shortcut KEY_PRESSED,,,Ctrl,false,true,false,false,true KEY_PRESSED,,,Alt Graph,true,true,false,false,true KEY_PRESSED,,+,Plus,true,true,false,false,true KEY_TYPED,\~,,Undefined,true,true,false,false,true KEY_RELEASED,,+,Plus,true,true,false,false,true KEY_RELEASED,,,Ctrl,true,false,false,false,false KEY_RELEASED,,,Alt Graph,false,false,false,false,false shows '\~' in the TextField control

GenericStyledArea -> type '\~' EvenType, char, textText, code.getname, alt, ctrl, shift,meta,shortcut KEY_PRESSED,,,Ctrl,false,true,false,false,true KEY_PRESSED,,,Alt Graph,true,true,false,false,true KEY_PRESSED,,+,Plus,true,true,false,false,true KEY_TYPED,~,,Undefined,true,true,false,false,true KEY_RELEASED,,+,Plus,true,true,false,false,true KEY_RELEASED,,,Ctrl,true,false,false,false,false KEY_RELEASED,,,Alt Graph,false,false,false,false,false shows '\~' in the TextField control

Mac: TextField -> type '\~' KEY_PRESSED,,,Alt,true,false,false,false,false KEY_RELEASED,,,Alt,false,false,false,false,false KEY_RELEASED,,ñ,N,false,false,false,false,false shows '\~' in the GenericStyledArea control

GenericStyledArea -> type '\~' R,KEY_PRESSED,,,Alt,true,false,false,false,false R,KEY_PRESSED,,,N,true,false,false,false,false R,KEY_TYPED,,,Undefined,true,false,false,false,false R,KEY_RELEASED,,,Alt,false,false,false,false,false R,KEY_RELEASED,,ñ,N,false,false,false,false,false no changes in the GenericStyledArea control

thereafter typing ' ' (space) R,KEY_PRESSED,,~,Space,false,false,false,false,false R,KEY_TYPED,\~,,Undefined,false,false,false,false,false R,KEY_RELEASED,, ,Space,false,false,false,false,false shows '\~' in the GenericStyledArea control

Jugen commented 4 years ago

Sorry for the delayed response. I wonder if this isn't maybe related to PR #922 ?

If your are using the latest RichTextFX 0.10.5 version, could you please try/test with the previous version 0.10.4 so we can see if this is the case. (I think the offending code may be !e.isAltDown() here which, if I'm not mistaken, wasn't there before.)

Alternatively we could try something like in PR #801 "Alternate keyboard layouts not supported", to address this issue.

Roel541 commented 4 years ago

The behaviour also exists in older versions (10.2). Removing the e.isAltDown does not solve the problem. I don't have a Mac , so I can't debug myself.

Buesing-Sebastian commented 3 years ago

I'm having the same issue too. I'm not really a JavaFX guy, so I couldn't do anything with your recommendations. I do however own a mac and could try out any solution someone might come up with.