Community
Participate
Working Groups
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
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.
Sorry, I have never really done any programming with SWT. Where can I get a simple StyledText example to play with?
Here you can find swt snippets: http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/platform-swt- home/dev.html About StyledText: http://www.eclipse.org/articles/StyledText%201/article1.html http://www.eclipse.org/articles/StyledText%202/article2.html
Lynne to investigate and advise.
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; } }
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.
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.
The mouse click at the beginning of a visual line is a known problem. See bug 24765.
Reassigning to inbox since OTT is taking ownership of StyledText.
This was fixed a long time ago. closing.