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

Bug 338981

Summary: Text VerifyEvent; Changing inserted text field inserts nothing or damages content
Product: [Eclipse Project] Platform Reporter: Doug M <eclipse>
Component: SWTAssignee: Lakshmi P Shanmugam <lshanmug>
Status: RESOLVED FIXED QA Contact: Silenio Quarti <Silenio_Quarti>
Severity: major    
Priority: P3 CC: lshanmug
Version: 4.1   
Target Milestone: 3.7 M6   
Hardware: Macintosh   
OS: Mac OS X   
Whiteboard:
Attachments:
Description Flags
Demo of bug.
none
patch none

Description Doug M CLA 2011-03-04 17:59:08 EST
Build Identifier: swt-3.7M5-cocoa-macosx-x86_64

The text field of a VerifyEvent received by a Text's VerifyListener contains the text about to be inserted. Changing this field is supposed to alter the inserted text. Instead nothing is inserted, or the changed text is inserted while following parts of the Text's contents are deleted.

Reproducible: Always

Steps to Reproduce:
1. Run attached code. Single typed characters should be converted to "X".
2. Observe that typing in the top paragraph substitutes X but deletes following paragraphs.
3. Observe that typing in later paragraphs inserts nothing.
Comment 1 Doug M CLA 2011-03-04 18:02:12 EST
Created attachment 190456 [details]
Demo of bug.
Comment 2 Lakshmi P Shanmugam CLA 2011-03-07 03:46:41 EST
Created attachment 190518 [details]
patch

We are not computing the length of the selected range correctly. The patch gets the selected range directly from the NSTextView and uses it.
Silenio, please review the patch.
Comment 3 Silenio Quarti CLA 2011-03-07 12:29:34 EST
Patch is good to release.
Comment 4 Lakshmi P Shanmugam CLA 2011-03-07 14:52:01 EST
Thanks Silenio!
Fixed in HEAD > 20110308.