Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 306764

Summary: [typing][BiDi] BIDI3.6_BDL: Wrong behavior of JavaEditor when typing parenthesis with active keyboard Hebrew
Product: [Eclipse Project] JDT Reporter: Ira Fishbein <fira>
Component: TextAssignee: JDT-Text-Inbox <jdt-text-inbox>
Status: RESOLVED WONTFIX QA Contact:
Severity: enhancement    
Priority: P5 CC: camle, daniel_megert, fira, kitlo, Lina.Kemmel, pwebster, sadir, tomerm
Version: 3.6Keywords: helpwanted
Target Milestone: ---   
Hardware: PC   
OS: Windows Vista   
Whiteboard:
Attachments:
Description Flags
parenthesis in JavaEditor none

Description Ira Fishbein CLA 2010-03-22 16:12:22 EDT
Build Identifier: 3.6.0 - I20100313-1044

1. Open Eclipse, create Java project and java class inside the project
2. When current keyboard is set to Hebrew, type (upper case – Hebrew characters):
private void ABC
3. now try to add empty parenthesis – ( )
  type '(' -> it will be displayed as ')'
  type ')' ->  it will add '( )'
the result will look like:   )()
Note: The same problem exists with curly brackets - {} and square brackets[]



Reproducible: Always
Comment 1 Ira Fishbein CLA 2010-03-22 16:13:23 EDT
Created attachment 162720 [details]
parenthesis in JavaEditor
Comment 2 Dani Megert CLA 2010-03-23 11:44:22 EDT
When I try to reproduce it, it inserts a '*' when typing '(' and a ')' when typing ')'. Guess that's because I have a different keyboard (yes, I switched to Hebrew input ;-).

Also verified in older versions: this never worked so far.

Lina, would you be willing to take a look?
Comment 3 Lina Kemmel CLA 2010-03-24 07:36:13 EDT
Hi,
This transformation (i.e. character mirroring, a.k.a. symmetric swapping) is provided on the OS level (input method).
When the keyboard language is a Bidi language, character received from the OS is already mirrored (swapped).

This behavior can be observed in a regular notepad:

1. Open an LTR notepad and type English characters 'abc'.
2. Switch keyboard language to Hebrew.
3. Type opening curly bracket and then opening square bracket.

Result: 'abc}]'

I.e. "mirrorable" characters typed on a Hebrew keybiard get mirrored - even though their resolved direction is LTR (notice that their relative order in display matches the typing sequence).

This transformation occurs not on display level - mirrored characters are introduced to the "buffer".

I don't think that this feature should be treated as a problem.

User can still input any desired character.
E.g. for opening bracket:
- by switching keyboard language to non-Bidi and typing the opening bracket,
- by typing a closing bracket (which Bidi users actually use to do when typing regular Bidi text..)
Comment 4 Dani Megert CLA 2010-03-24 13:01:03 EDT
I agree. If it comes from the OS then there's not much we can here.
Comment 5 Ira Fishbein CLA 2010-04-18 09:22:02 EDT
Although it comes from OS, I still believe there is something that can be done. 
For example, when keyPressed event accures, if current language is Bidi, parenthesis might be switched. 
When Bidi users type regular Bidi text, it is typed from right to left and therefore it makes sence to type closing parenthesis instead of an opening one. In this case, the 'icon' on the keyboard is identical to the displayed character. In JavaEditor the situation is different, the 'icon' on the keyboard is different from the displayed character.
Comment 6 Dani Megert CLA 2010-04-19 09:14:42 EDT
Patch would be welcome.
Comment 7 Lina Kemmel CLA 2010-04-19 09:26:10 EDT
Sorry, I think we should not violate the default Windows keyboard mapping..

Symbols displayed on the keyboard keys for mirrrorable characters mismatch the glyphs seen on display indeed (which happens either in LTR or RTL direction BTW), however keyboards are not Windows-centric and thus do not reflect Windows specifics.
Comment 8 Dani Megert CLA 2010-04-19 09:57:58 EDT
I also tend to agree with Lina.
Comment 9 Dani Megert CLA 2013-08-07 09:28:46 EDT
.