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

Bug 339138

Summary: Text limit for Text widget doesn't work in some cases
Product: [Eclipse Project] Platform Reporter: Lakshmi P Shanmugam <lshanmug>
Component: SWTAssignee: Lakshmi P Shanmugam <lshanmug>
Status: RESOLVED FIXED QA Contact: Silenio Quarti <Silenio_Quarti>
Severity: normal    
Priority: P3 CC: Silenio_Quarti
Version: 3.7Flags: Silenio_Quarti: review+
Target Milestone: 3.7 RC1   
Hardware: PC   
OS: Mac OS X   
Whiteboard:
Attachments:
Description Flags
patch none

Description Lakshmi P Shanmugam CLA 2011-03-07 14:27:24 EST
Reproducible with Cocoa HEAD.

Came across this while working on a different Text bug.
Text.append(), insert(), paste() don't check for textlimit before changing the text.

Test snippet:

public static void main(String[] args) {
			Display display = new Display();
			Shell shell = new Shell(display);
			shell.setSize(200, 75);
			GridLayout layout = new GridLayout(1, false);
			shell.setLayout(layout);
			Text text = new Text(shell, SWT.BORDER|SWT.MULTI);
			text.setLayoutData(new GridData(GridData.FILL_BOTH));
			text.setTextLimit(6);
			text.setText("124");
			text.insert("456789");
			shell.open();
			while (!shell.isDisposed()) {
				if (!display.readAndDispatch())
					display.sleep();
			}
			display.dispose();
	}
Comment 1 Lakshmi P Shanmugam CLA 2011-04-05 07:08:24 EDT
Created attachment 192541 [details]
patch
Comment 2 Lakshmi P Shanmugam CLA 2011-04-19 06:14:36 EDT
Hi Silenio,
Can you please review for M7?
Comment 3 Silenio Quarti CLA 2011-04-26 10:32:52 EDT
Patch is good.
Comment 4 Lakshmi P Shanmugam CLA 2011-05-02 05:40:30 EDT
Fixed in HEAD > 20110502. 
Thanks Silenio.