Community
Participate
Working Groups
When using the Find dialog to search and replace in a text file, if the text file has very long lines, at some point clicking next in the dialog takes you to the next selection, but it is not visible within the editor. I'm attaching a file in which this behavior happens - open the file, Apple-F, type in tr-NEXUS in the search field, then the 30th click of Find doesn't show the selection. This is on eclipse 3.1 using Java 1.4.2_09 on OSX 10.4.2
Created attachment 26259 [details] file with long lines
Works for me using R3.1 on WindowsXP. Which build id? André, can you reproduce on Mac? Moving to SWT.
In mac we can't handle long strings (in my machine anything over 4500 characters stop working). TextLayout and GC#drawString are broken the same way. public class PR107362 { public static void main(String[] args) { final Display display = new Display(); final Shell shell = new Shell(display); final Font font = display.getSystemFont(); final StringBuffer buffer = new StringBuffer(); for (int i = 0; i < 1000; i++) { buffer.append("Word "); } buffer.append("Last"); System.out.println("Buffer length: " + buffer.length()); shell.addListener(SWT.Paint, new Listener() { public void handleEvent(Event event) { TextLayout layout = new TextLayout(event.display); layout.setOrientation(shell.getStyle() & (SWT.RIGHT_TO_LEFT | SWT.LEFT_TO_RIGHT)); layout.setText(buffer.toString()); layout.setFont(font); Rectangle ca = shell.getClientArea(); Rectangle textBounds = layout.getBounds(); layout.draw(event.gc, ca.width - textBounds.width - 10, 10); layout.dispose(); event.gc.setFont(font); event.gc.drawString(buffer.toString(), ca.width - textBounds.width - 10, 80); } }); shell.setSize(280, 240); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose (); } }
SSQ: don't you have a duplicate for this ?
Scott, is this a known problem on Mac?
This is the first time I have seem this problem.
Grant, is 4500 characters a hard-and-fast limit or does it seem to be stopping at roughly that amount? It could be that 4500 characters times the width of a character overflows an Int32, and that's confusing CoreGraphics in some way. I will file a bug linking back to this one.
Hey Scott, I reported comments 3 and 4. (Grant was logged in bugzilla on my machine, I didn't notice that till I saw the notification). I think the limit is in the width not in the number of chars. The textbounds in example is 32767 (which is 0x7FFF). I talked to SSQ and he said the type Fixed has 16 bits for the whole number and 16 bits for the decimal part. 16 bits minus one bit for signal gives 15 bits (0x7FFF). Scott, do you agree the above ? Can this be fixed ?
Ah, the dreaded Fixed type. If it overflows on addition, the value of the result will be clamped to 32767.0. TextLayout.computeRuns() is the likely culprit here -- ATSUGetGlyphBounds is probably returning 32767.0 for the longest string, and then the Fix2Long converts to the integer value 32767. Do text editors in eclipse support wrapping lines after some fixed character width? I didn't see an option for it in the preferences. I know that TextMate and BBEdit can do this. I don't think this is fixable by the SWT, because even if you could internally overcome the limitations of the Fixed type, ATSUI won't be able to draw a string that wide. You'd have to look into introducing your own soft breaks and forcing a wrap.
>Do text editors in eclipse support wrapping lines after some fixed character Not out of the box, but people can build their own editor and set the SWT.WRAP flag on StyledText.
Your bug has been moved to triage, visit http://www.eclipse.org/swt/triage.php for more info.
Bug triaged, visit https://wiki.eclipse.org/SWT/Devel/Triage for more inforamation.
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. As such, we're closing this bug. If you have further information on the current state of the bug, please add it and reopen this bug. 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. -- The automated Eclipse Genie.