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

Bug 357957

Summary: StyledText crashes on a 3rd party Chinese IME
Product: [Eclipse Project] Platform Reporter: khkong
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: critical    
Priority: P3 CC: curtis.windatt.public, eclipse.felipe, khkong, remy.suen
Version: 4.2   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard: stalebug
Attachments:
Description Flags
Reproduce steps for IME crash issue on StyledText
none
3rd party IME Install steps none

Description khkong CLA 2011-09-16 12:03:02 EDT
Build Identifier: org.eclipse.swt.win32.win32.x86_3.6.2.v3659c-RCP20110402-1912.jar

I was told that http://www.unispim.com/ is a popular IME in China.  However, it crashes the StyledText widget when used in a certain way.  Details on how to install and use the IME is provided in the attached files.

I notice that in Notepad or other editor, characters typed onto the IME editor does not get entered, but it's different for StyledText.

Reproducible: Always

Steps to Reproduce:
1. Press Ctrl+Space to turn on Chinese input 
2. Input "we" and then press Ctrl+Space to switch back in English input. "w'e" got entered into the editor.
3. Press backspace to delete "e", then press Backspace again
4. Application error occurred with the following stack trace:
CLPDN0031E: Event loop exception
java.lang.StringIndexOutOfBoundsException
		 at java.lang.StringBuffer.append(Unknown Source)
		 at org.eclipse.swt.custom.DefaultContent.getTextRange(Unknown Source)
		 at org.eclipse.swt.custom.DefaultContent.isValidReplace(Unknown Source)
		 at org.eclipse.swt.custom.DefaultContent.replaceTextRange(Unknown Source)
		 at org.eclipse.swt.custom.StyledText.modifyContent(Unknown Source)
		 at org.eclipse.swt.custom.StyledText.sendKeyEvent(Unknown Source)
		 at org.eclipse.swt.custom.StyledText.doContent(Unknown Source)
		 at org.eclipse.swt.custom.StyledText.handleKey(Unknown Source)
		 at org.eclipse.swt.custom.StyledText.handleKeyDown(Unknown Source)
		 at org.eclipse.swt.custom.StyledText$7.handleEvent(Unknown Source)
		 at org.eclipse.swt.widgets.EventTable.sendEvent(Unknown Source)
		 at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
		 at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
		 at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
		 at org.eclipse.swt.widgets.Widget.sendKeyEvent(Unknown Source)
		 at org.eclipse.swt.widgets.Widget.sendKeyEvent(Unknown Source)
		 at org.eclipse.swt.widgets.Widget.wmChar(Unknown Source)
		 at org.eclipse.swt.widgets.Control.WM_CHAR(Unknown Source)
		 at org.eclipse.swt.widgets.Canvas.WM_CHAR(Unknown Source)
		 at org.eclipse.swt.widgets.Control.windowProc(Unknown Source)
		 at org.eclipse.swt.widgets.Canvas.windowProc(Unknown Source)
		 at org.eclipse.swt.widgets.Display.windowProc(Unknown Source)
		 at org.eclipse.swt.internal.win32.OS.CallWindowProcW(Native Method)
Comment 1 Curtis Windatt CLA 2011-09-16 12:06:02 EDT
Moving to SWT
Comment 2 khkong CLA 2011-09-16 12:25:42 EDT
Created attachment 203495 [details]
Reproduce steps for IME crash issue on StyledText
Comment 3 khkong CLA 2011-09-16 12:29:58 EDT
Created attachment 203496 [details]
3rd party IME Install steps
Comment 4 khkong CLA 2011-10-19 09:18:52 EDT
Just a quick follow up to see if any progress on this issue.  Thanks.
Comment 5 Felipe Heidrich CLA 2011-10-19 16:00:19 EDT
Okay, I just tried the case

For me the "we" is visible in StyledText during the composition (the same does not happen on notepad), but the second I press ctrl key the composition is committed to StyledText and the correct Chinese characters are inserted.
Delete them using backspace works fine.

Notepad also commits the composition when the ctrk key is pressed.

The only difference I see is that during the pre-edit phase StyledText shows the composition in the widget.
I was not able to reproduce the exception.

Please try again using a new version of SWT.
I'm testing with Eclipse 3.8M2
Comment 6 Lars Vogel CLA 2019-11-14 03:45:30 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

If the bug is still relevant, please remove the "stalebug" whiteboard tag.