Modify

Opened 11 years ago

Closed 11 years ago

Last modified 10 years ago

#528 closed defect (fixed)

Chinese text input in tags doesn't work as expected

Reported by: d@… Owned by: framm
Priority: major Milestone:
Component: Core Version: tested
Keywords: Cc:

Description

When trying to enter Chinese text in a tag the autocomplete doesn't work as expected. This is on Windows with Metal theme, not sure if other platforms have the same problem.

Things required to reproduce...
1) A Chinese IME installed, the standard windows Pinyin one will do.
2) An open dataset with Chinese in, e.g. Hangzhou at 30.274/120.158

Steps to reproduce
1) Choose an object with no name
2) Click Add under properties to add a tag
3) Type name in Key
4) In Value, switch the Chinese input, shift-alt or ctrl-space are defaults depending on what language mode you are in, alternatively use the language bar...
5) Start typing a name that exists in the data, such as 文三路 (wen san lu)...

typing wen shows the characters wen displayed strong highlighted in the input box with the character chooser below it, choose 2 for 文, it'll then autocomplete with something that starts with 文, e.g. 文一西路 (wen yi xi lu), at this point, 文 is unselected, but the remaining characters are selected (highlighted), we should be able to just type 三 (san) at this point to enter the next character, typing san, shows the characters san appear after the entire autocompleted string, choosing 1 from the IME, for 三 gives us 文一西路三, all we've typed is wen and san, the first and last characters, the bit in between is autocomplete that hasn't been overwritten by 三. So, seeing this, I delete the 三 (san) off the end, put the cursor directly after the 文 (wen) and try to type 三 (san) here, inserting between 文 and 一西路 that came from auto completion... What I get after typing 's' is 文s一西路 with the s with a strong highlight and the 一西路 with a lighter highlight, looking OK, then when continue and type 'a' after the 's' what I get is 文s一西sa, with 一西 light highlighted, the 'sa' at the end strong highlighted, there are now two 's', only one was typed, also, of the three characters from autocomplete, 一 (yi (one)) 西 (xi (west)) and 路 (lu (road)) only two are left, the last one, 路 (lu), has vanished... Complete the entry of 三 and it ends up as 文s一西三...

I think that's enough to get the idea, make it somewhat interesting to work with...

Attachments (0)

Change History (6)

comment:1 Changed 11 years ago by d@…

I'm wondering if the key bit is that JOSM seems to be capturing the keystrokes, with most other software, the entered text appears in the IME's text box, only the selected character is then placed into the applications text box. This didn't seem to be as big a problem in older 0.5/modeless versions of JOSM...

Also, after experiencing this problem, I've noticed that the autocomplete functionality now also has some more problems with non-chinese input, type in a value, move the cursor back through the typed text and try to insert something, e.g. The at the beginning, the first character typed triggers the rest of the text following it to be highlighted as if it was from autocomplete with the cursor placed at the end of the string, even this is a value that doesn't exist anywhere, the second keystroke overwrites the remainder of the text as you'd expect from the highlighting. Moving the cursor back to the text entry point removes the highlighting and allows you to enter the second character, but the cursor positioning and highlighting happen again, so the same needs to be done before the third character. I'll try restart JOSM and see if this is happening without trying to enter Chinese text first, if it does, I'll raise a separate ticket for this problem.

comment:2 Changed 11 years ago by Gabriel Ebner <ge@…>

Okay, I just tried using scim's "smart pinyin" IM and java 6. Adding the first name=文三路 tag works just fine. However when I try to add a second name tag, things get hairy: If I write 文三路 in one go,I'll get 文三文三路. If I just write the first character 文, JOSM will autocomplete that to 文三路 (even though it shows other weird characters while typing that in...).

And all the while, we get these scary exceptions:

Exception occurred during event dispatching:
java.lang.IllegalArgumentException: Invalid substring range
        at java.text.AttributedString$AttributedStringIterator.<init>(AttributedString.java:739)
        at java.text.AttributedString.getIterator(AttributedString.java:566)
        at javax.swing.text.Utilities.drawComposedText(Utilities.java:857)
        at javax.swing.text.PlainView.drawElement(PlainView.java:90)
        at javax.swing.text.PlainView.drawLine(PlainView.java:71)
        at javax.swing.text.PlainView.paint(PlainView.java:288)
        at javax.swing.text.FieldView.paint(FieldView.java:171)
        at javax.swing.plaf.basic.BasicTextUI$RootView.paint(BasicTextUI.java:1421)
        at javax.swing.plaf.basic.BasicTextUI.paintSafely(BasicTextUI.java:725)
        at javax.swing.plaf.basic.BasicTextUI.paint(BasicTextUI.java:868)
        at javax.swing.plaf.basic.BasicTextUI.update(BasicTextUI.java:847)
        at javax.swing.JComponent.paintComponent(JComponent.java:763)
        at javax.swing.JComponent.paint(JComponent.java:1027)
        at javax.swing.JComponent.paintToOffscreen(JComponent.java:5122)
        at javax.swing.BufferStrategyPaintManager.paint(BufferStrategyPaintManager.java:285)
        at javax.swing.RepaintManager.paint(RepaintManager.java:1128)
        at javax.swing.JComponent._paintImmediately(JComponent.java:5070)
        at javax.swing.JComponent.paintImmediately(JComponent.java:4880)
        at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:723)
        at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:679)
        at javax.swing.RepaintManager.seqPaintDirtyRegions(RepaintManager.java:659)
        at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:128)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:177)
        at java.awt.Dialog$1.run(Dialog.java:1039)
        at java.awt.Dialog$3.run(Dialog.java:1091)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.awt.Dialog.show(Dialog.java:1089)
        at java.awt.Component.show(Component.java:1419)
        at java.awt.Component.setVisible(Component.java:1372)
        at java.awt.Window.setVisible(Window.java:801)
        at java.awt.Dialog.setVisible(Dialog.java:979)
        at org.openstreetmap.josm.gui.dialogs.PropertiesDialog.add(PropertiesDialog.java:267)
        at org.openstreetmap.josm.gui.dialogs.PropertiesDialog$10.actionPerformed(PropertiesDialog.java:411)
        at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
        at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
        at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
        at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
        at javax.swing.plaf.basic.BasicButtonListener$Actions.actionPerformed(BasicButtonListener.java:287)
        at javax.swing.SwingUtilities.notifyAction(SwingUtilities.java:1636)
        at javax.swing.JComponent.processKeyBinding(JComponent.java:2849)
        at javax.swing.KeyboardManager.fireBinding(KeyboardManager.java:267)
        at javax.swing.KeyboardManager.fireKeyboardAction(KeyboardManager.java:216)
        at javax.swing.JComponent.processKeyBindingsForAllComponents(JComponent.java:2926)
        at javax.swing.JComponent.processKeyBindings(JComponent.java:2918)
        at javax.swing.JComponent.processKeyEvent(JComponent.java:2812)
        at java.awt.Component.processEvent(Component.java:5815)
        at java.awt.Container.processEvent(Container.java:2058)
        at java.awt.Component.dispatchEventImpl(Component.java:4410)
        at java.awt.Container.dispatchEventImpl(Container.java:2116)
        at java.awt.Component.dispatchEvent(Component.java:4240)
        at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1848)
        at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:697)
        at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:962)
        at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:834)
        at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:661)
        at java.awt.Component.dispatchEventImpl(Component.java:4282)
        at java.awt.Container.dispatchEventImpl(Container.java:2116)
        at java.awt.Window.dispatchEventImpl(Window.java:2429)
        at java.awt.Component.dispatchEvent(Component.java:4240)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)

Anybody know both java and IMs?

As for your second question, I can confirm weird behaviour. Autocompletion is quite a hacky feature with all sorts of warts to make it usable (if any swing guru is listening, is there any right way to do it?).

comment:4 Changed 11 years ago by anonymous

Does this still happen in new JOSM versions? The AtoCompletion has been fixed a lot to remove many problems.

comment:5 Changed 11 years ago by anonymous

Resolution: fixed
Status: newclosed

Closing. Should be fixed by autocompletion correction.

comment:6 Changed 10 years ago by dqwmayinng

Version: release

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain framm.
as The resolution will be set.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.