Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 38280 - StyledText - Cannot delete character at wrapped end of line in SWT styled text box
Summary: StyledText - Cannot delete character at wrapped end of line in SWT styled te...
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows 2000
: P3 normal with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Felipe Heidrich CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-05-30 15:38 EDT by David Buttler CLA
Modified: 2007-07-05 17:14 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Buttler CLA 2003-05-30 15:38:12 EDT
I am using the color editor 0.2.8 written by Chris Grindstaff.  I modified the 
source to make the editor autowrap.  However, it seems when I am editting a 
particularly long line, I cannot delete characters at the end of line that is 
wrapped.  If I move forward to the next character (on the next line) I can 
backspace without a problem.

JVM Sun 1.3.1
Win 2K
Eclipse 2.1 Released build
Comment 1 Felipe Heidrich CLA 2003-06-02 10:29:17 EDT
Hey David, can you post an example code using only SWT that shows the problem ? 
I think you can reproduce this just with a StyledText and your code to autowrap 
lines. 
Comment 2 David Buttler CLA 2003-06-02 11:33:11 EDT
Sorry, I have never really done any programming with SWT. Where can I get a
simple StyledText example to play with?
Comment 4 Steve Northover CLA 2003-06-04 14:19:17 EDT
Lynne to investigate and advise.
Comment 5 Lynne Kues CLA 2003-06-04 14:46:49 EDT
Verified the problem.  Run the attached test case.  Place the cursor at the end 
of the first visual line.  Press the delete key, nothing happens.

import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

/**
 */
public class TextEditor {  
	Shell shell;
	StyledText text;

void createShell (Display display) {
	shell = new Shell (display);
	shell.setText ("Test Wrap");	
	GridLayout layout = new GridLayout();
	layout.numColumns = 1;
	shell.setLayout(layout);
}
void createStyledText() {
	text = new StyledText (shell, SWT.BORDER | SWT.MULTI | SWT.WRAP);
	GridData spec = new GridData();
	spec.horizontalAlignment = GridData.FILL;
	spec.grabExcessHorizontalSpace = true;
	spec.verticalAlignment = GridData.FILL;
	spec.grabExcessVerticalSpace = true;
	text.setLayoutData(spec);
	text.setText("This is a really long line that will wrap and wrap and 
wrap over many lines - end of line 1."
+ "\r\nAnd this is another line of text with lots of words that will also wrap 
and go over many many lines - end of line 2."
+ "\r\nAnd this is yet another line of text - end of line 3.");
}

public static void main (String [] args) {
	Display display = new Display ();
	TextEditor example = new TextEditor ();
	Shell shell = example.open (display);
	while (!shell.isDisposed ())
		if (!display.readAndDispatch ()) display.sleep ();
	display.dispose ();
}

public Shell open (Display display) {
	createShell (display);
	createStyledText ();
	shell.setSize(200, 100);
	shell.open ();
	return shell;
}

}
Comment 6 Lynne Kues CLA 2003-06-04 14:56:47 EDT
Problem also exists in 2.0.2, so it was not introduced by any 2.1 changes.  
Knut, can you have a look.  I am also unable to place the cursor at the 
beginning of a visual line via a mouse click.
Comment 7 Knut Radloff CLA 2003-06-04 15:27:03 EDT
Also:
-place the caret at the beginning of the second visual line 
-press delete
->the caret jumps to the end of the first visual line. It should have deleted 
the first character of the second visual line. It should do the same when at 
the end of the first visual line since the two positions are the same from a 
logical point of view. It should also jump to the beginning of the second 
visual line (the delete location) when pressing delete at the end of the first 
visual line.
Comment 8 Knut Radloff CLA 2003-06-05 10:17:35 EDT
The mouse click at the beginning of a visual line is a known problem. See bug 
24765.
Comment 9 Knut Radloff CLA 2003-09-04 17:13:45 EDT
Reassigning to inbox since OTT is taking ownership of StyledText.
Comment 10 Felipe Heidrich CLA 2007-07-05 17:14:04 EDT
This was fixed a long time ago.
closing.