This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
>System Info: Product Version = NetBeans IDE Dev (Build 200408161800) Operating System = Windows XP version 5.1 running on x86 Java; VM; Vendor = 1.5.0-beta2; Java HotSpot(TM) Client VM 1.5.0-beta2-b51; Sun Microsystems Inc. Java Home = C:\Program Files\Java\jdk1.5.0\jre System Locale; Encod. = pl_PL (nb); Cp1250 To enter polish character "¹" I have to press "a" while holding "Alt Gr" pressed. When I do this whole section of text is replaced with "¹" instead of just inserting the letter. The reason probably is that "Alt Gr" is an equivalent of right Alt+Ctrl, and Alt+Ctrl+a does some kind of section select, which is immediately replaced by character "¹". Here's how it should work: - pressing AltGr+a should insert "¹" - it should call Alt+Ctrl+a shortcut - pressing left Alt+Ctrl+a should: * call the shortcut Alt+Ctrl+a * insert "¹" if there is NO shortcut Alt+Ctrl+a This is the way Microsoft Office works. To reproduce: install and activate "polish programmer" keyboard layout.
Adding I18N keyword
Using http://java.sun.com/docs/books/tutorialJWS/uiswing/events/example- 1dot4/KeyEventDemo.jnlp I checked the codes of keys, here's the result of pressing and immediate releasing of: LEFT CONTROL ============ KEY PRESSED: key code = 17 (Ctrl) modifiers = 128 (Ctrl) action key? NO key location: left KEY RELEASED: key code = 17 (Ctrl) modifiers = 0 (no modifiers) action key? NO key location: left LEFT ALT ======== KEY PRESSED: key code = 18 (Alt) modifiers = 512 (Alt) action key? NO key location: left KEY RELEASED: key code = 18 (Alt) modifiers = 0 (no modifiers) action key? NO key location: left ALT GR ======= KEY PRESSED: key code = 17 (Ctrl) modifiers = 128 (Ctrl) action key? NO key location: left KEY PRESSED: key code = 18 (Alt) modifiers = 640 (Ctrl+Alt) action key? NO key location: right KEY RELEASED: key code = 17 (Ctrl) modifiers = 512 (Alt) action key? NO key location: left KEY RELEASED: key code = 18 (Alt) modifiers = 0 (no modifiers) action key? NO key location: right LEFT CTRL + LEFT ALT + A ======================== KEY PRESSED: key code = 17 (Ctrl) modifiers = 128 (Ctrl) action key? NO key location: left KEY PRESSED: key code = 18 (Alt) modifiers = 640 (Ctrl+Alt) action key? NO key location: left KEY PRESSED: key code = 65 (A) modifiers = 640 (Ctrl+Alt) action key? NO key location: standard KEY TYPED: key character = '¹' modifiers = 8192 (Alt Graph) action key? NO key location: unknown KEY RELEASED: key code = 65 (A) modifiers = 640 (Ctrl+Alt) action key? NO key location: standard KEY RELEASED: key code = 18 (Alt) modifiers = 128 (Ctrl) action key? NO key location: left KEY RELEASED: key code = 17 (Ctrl) modifiers = 0 (no modifiers) action key? NO key location: left ALT GR + A ========== KEY PRESSED: key code = 17 (Ctrl) modifiers = 128 (Ctrl) action key? NO key location: left KEY PRESSED: key code = 18 (Alt) modifiers = 640 (Ctrl+Alt) action key? NO key location: right KEY PRESSED: key code = 65 (A) modifiers = 640 (Ctrl+Alt) action key? NO key location: standard KEY TYPED: key character = '¹' modifiers = 8192 (Alt Graph) action key? NO key location: unknown KEY RELEASED: key code = 65 (A) modifiers = 640 (Ctrl+Alt) action key? NO key location: standard KEY RELEASED: key code = 17 (Ctrl) modifiers = 512 (Alt) action key? NO key location: left KEY RELEASED: key code = 18 (Alt) modifiers = 0 (no modifiers) action key? NO key location: right Hope it helps.
The problem is that the java is unable to distinguish between the Ctrl+Alt+A and AltGr+A. As we have an "Select Next Element" action mapped to Ctrl+Alt+A it will get invoked on the key_pressed event. After that there comes the key_typed which inserts the special char. To get it work properly the only way I see is to unmap the Ctrl+Alt+A binding or remap it to something else. You can unmap the Ctrl+Alt+A in Tools->Options->Editing->Editor Settings->Java Editor->Key Bindings search for "Select Next Element" action, click on the key binding and remove it.
What about adding an option, saying that right Alt shouldn't be used for shortcuts? It's not only about Alt+Ctrl+a, but also in some button shortcuts. For example in Auto comment dialog, I cannot enter letter "³", because it inserts "{@link }".
I think the jvm is unable to distinguish between left and right alt so the only permanent solution would be to use *no* Ctrl+Alt+<key> shortcuts throughout the whole IDE. This is possible although right now we are short of the available shortcuts anyway so this would make the situation even worse. Passing to ui module for evaluation whether this would be doable.
Why do you say jvm is unable to distinguish between left and right alt? Look at my comment #2, the output from java sample says: LEFT ALT ======== KEY PRESSED: key code = 18 (Alt) key location: left ^^^^ ALT GR ======= KEY PRESSED: key code = 18 (Alt) key location: right ^^^^^
Yes I did not say it right as I was looking mainly to the produced key_typed events that cause the document insertions. They seem to be the same in both cases: LEFT CTRL + LEFT ALT + A ======================== KEY TYPED: key character = '¹' modifiers = 8192 (Alt Graph) action key? NO key location: unknown ALT GR + A ========== KEY TYPED: key character = '¹' modifiers = 8192 (Alt Graph) action key? NO key location: unknown In theory it would be possible to eliminate the key_typed events in specific conditions i.e. eliminate the key_typed that came after the key_pressed with right alt pressed. We did those kinds of patches in the past to overcome various JDK keyboard related flaws. The problem is that the patches usually do not work well across platforms and various keyboard layouts - please see e.g. the issue 44307.
Milo, I have to return this issue back to you, because I don't understand what your request actually is and how could core solve that. I understand the original problem, but I don't understand role of core in this. Is core blocking you to differentiate between left and right Alt or what?
> In theory it would be possible to eliminate the key_typed > events in specific conditions i.e. eliminate the key_typed > that came after the key_pressed with right alt pressed. Because of possible compatibility problems I suggest to add an option to simply ignore right Alt in shortcuts (do not execute any shortcut if right alt is pressed). For US keyboards the option will be off by default, so it will change nothing. For other layouts users will turn it on, so that right alt will be used only for special characters (alt graph), and let alt only for shortcuts. Note that when left alt is used, editor should eat the KEY TYPED "¹" event not to overwrite block selected with the shortcut.
Apologies, Dafe, originally I was transfering to ui/ui hoping that the UI people will comment on the proposal to eliminate Ctrl+Alt+<key> shortcuts from being used for the IDE shortcuts completely. Actually there should not be many of those - I've found just two by scanning the main window menu under Tools->JUnit Tests - Ctrl+Alt+J and Ctrl+Alt+K and there are few used in the editor. I've put ui issues on cc.
Note that it also affects buttons in some dialogs, like in auto comment dialog.
To Cezariusz: As I've already mentioned the keyboard patching (eating key_typed etc.) is a thin ice so I would prefer other solution if possible. > For other layouts users will turn it on IMHO just few people would find the option as hardly anyone would expect that such configurable option would be present in the IDE. Turning it on automatically would IMHO not be easy either as I'm not aware of how to find out the current keyboard layout in java programatically. I'll talk to our UI people regarding this issue.
Similar issue I just helped someone out with on the Apple java mailing list - Alt-Shift-8 (winsys defined) is the way to do a { character. We may want to think hard about some system that works better for both per-locale and per-platform bindings.
------- Additional Comments From Miloslav Metelka 2004-08-19 11:34 PDT ------- > I'll talk to our UI people regarding this issue. Any conclusions?
I have entered issue #49945 and fixed it today which should eliminate this problem.
Verified in 200606120200.