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.

Bug 114712

Summary: I18N: caret is not rendered at all during composing Japanese
Product: editor Reporter: Masaki Katakai <masaki>
Component: -- Other --Assignee: Vitezslav Stejskal <vstejskal>
Status: RESOLVED FIXED    
Severity: blocker CC: jf4jbug
Priority: P2 Keywords: I18N
Version: 6.x   
Hardware: PC   
OS: Windows XP   
Issue Type: DEFECT Exception Reporter:
Attachments: screenshot: diff between Windows native app and NetBeans editor
screenshot of 200709060000: white rectangle is overlapped in left two images during composing. right two images (without composing) are good.
screen capture : unzip then open .html in browser

Description Masaki Katakai 2007-09-05 08:01:35 UTC
Windows XPSP2 Japanese
NetBeans 6.0 200709021200
JDK1.6.0_02
IM: IME 2002

Caret is not being rendered at all during composing Japanese strings.
Some engines use a caret to represent the insert position even in the
composed string.

Caret position can be retrieved by caretPositionChanged() of InputMethodListener.

http://java.sun.com/javase/6/docs/api/java/awt/event/InputMethodListener.html#caretPositionChanged(java.awt.event.InputMethodEvent)

getCaret() can get the info from InputMethodEvent.

http://java.sun.com/javase/6/docs/api/java/awt/event/InputMethodEvent.html#getCaret()
Comment 1 Masaki Katakai 2007-09-05 08:05:37 UTC
Created attachment 48124 [details]
screenshot: diff between Windows native app and NetBeans editor
Comment 2 Vitezslav Stejskal 2007-09-05 16:03:07 UTC
The complete discussion of the InputMethods support was in issue #14549.
Comment 3 Vitezslav Stejskal 2007-09-07 08:28:40 UTC
Hi Masaki, two questions please:

1. When this happens, is the caret completely invisible or is it visible somewhere else in the text (ie at wrong position)
2. Could you please try this with M10 and check whether the caret behavior was the same?

Thanks a lot
Comment 4 Masaki Katakai 2007-09-07 13:12:03 UTC
Hi Vita,

Thank you for taking.

1. caret is completely invisible when I start to input
    It seems that when composed text is existing, the caret is not displayed at all

2. the behavior is the same with M10 (also nb5.5.1)

Regards.
Comment 5 Masaki Katakai 2007-09-07 13:40:44 UTC
Vita, have you changed some codes for this fix in trunk??

I noticed that 200709060000 nightly is drawing the caret!!

It almost works but it's still not perfect. There is a white
rectangle in the left side of caret and it's overlapped on
the left character.

I'll attach the screenshot.
Comment 6 Masaki Katakai 2007-09-07 13:44:44 UTC
Created attachment 48389 [details]
screenshot of 200709060000: white rectangle is overlapped in left two images during composing. right two images (without composing) are good.
Comment 7 Vitezslav Stejskal 2007-09-07 14:23:28 UTC
There were some rendering problems in the editor, which is probably what you saw. I didn't change anything in particular
to fix this issue. Could you please try with the latest build and make sure you are not writing to the last line in the
editor (issue #114942). Actually, I made a fix for another issue in BaseCaret, which could affect the behavior while
input methods are active. Please try next nightly build and let me know. Thanks
Comment 8 Vitezslav Stejskal 2007-09-11 10:44:32 UTC
Hi Masaki, could you please try this with the latest dev build and let me know if the issue is still there? Thanks
Comment 9 Masaki Katakai 2007-09-11 15:18:24 UTC
Hi Vita,

I tried 200709110000 build, it's not working now.

If there are 4 characters begin composed, when I move the cursor by arrow key,

|X|XXX : drawing
XX|X|X| : these positions are not working

If I remember correctly, when I tried the build 200709060000, the caret was displayed
(but with white rectangle) in these positions.



Comment 10 Masaki Katakai 2007-09-11 15:23:06 UTC
Created attachment 48579 [details]
screen capture : unzip then open .html in browser
Comment 11 Vitezslav Stejskal 2007-09-11 16:44:16 UTC
Thanks for that, I think the white rectangle was a bug (already fixed) in text rendering unrelated to the caret. Since
this works in most cases and I have no idea what the problem could be and how to fix it I would like to ask for 6.0
waiver. Do you agree? 
Comment 12 Vitezslav Stejskal 2007-09-12 09:24:59 UTC
I am going to ask for 6.0 waiver. The problem was reported only on Windows XP, on other platforms composed text is
displayed correctly including the caret. It's definitely annoying, but not really critical, even without visible caret
it is possible to enter composed text and the text is highlighted correctly during transitions.
Comment 13 Masaki Katakai 2007-09-12 15:01:54 UTC
No problem for me. Thank you Vita for the investigation.
Comment 14 Masaki Katakai 2007-09-20 15:44:00 UTC
On 200709200000 build, caret is not displayed at all again.

On 200709110000 build, as I commented, it was visible at some position,
but on the current build, I can not see the caret in any position.
Comment 15 Ken Frank 2008-01-10 19:45:33 UTC
can we consider this one for 6.1 fix ?

ken.frank@sun.com
Comment 16 Vitezslav Stejskal 2008-01-23 09:32:39 UTC
We will see what can be done, but we still don't know what the problem is.
Comment 17 Jan Becicka 2008-02-01 16:18:55 UTC
Really planned for 6.1?
Comment 18 Vitezslav Stejskal 2008-02-11 16:19:42 UTC
There are useful comments and guidelines for setting up chinese/japanese locales in issue #14549. It might be useful to
read through it for understanding how to reproduce this problem.
Comment 19 Ken Frank 2008-02-11 17:16:57 UTC
I'll send Vita some much more updated info about locale setup
and usage than what is in 14549.

ken.frank@sun.com
Comment 20 Miloslav Metelka 2008-02-13 15:24:43 UTC
I was already able to reproduce on Windows and currently I'm making debugging builds. Currently it seems that the input
methods set blinking rate to zero and then the caret does not get painted (possibly because there is a painting code
that renders the glyphs but does not render the caret afterwards). But I need to do some more research and since I'm
testing on another machine it's progressing slowly.
Comment 21 Miloslav Metelka 2008-02-28 12:50:34 UTC
I've finally found the problem. The rendering in JTextComponent.ComposedTextCaret.paint() renders white-on-white so the
installed ComposedCaret becomes invisible.
It's likely because the code in JTextComponent.ComposedTextCaret.install() sets the 'bg' variable to the component's
background color. In JDK Document impls the background color of composed text is typically reverse of the background so
this does not happen.
Since we do not currently have the character elements root implementation a better would be to just set the background
color to the component's foreground before caret's rendering gets called.
Fixed: http://hg.netbeans.org/main?cmd=changeset;node=f1c1b3467b65