| Summary: | Editor viewport not correct after restart | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Benno Baumgartner <benno.baumgartner> | ||||||
| Component: | UI | Assignee: | Platform-UI-Inbox <Platform-UI-Inbox> | ||||||
| Status: | RESOLVED DUPLICATE | QA Contact: | |||||||
| Severity: | normal | ||||||||
| Priority: | P3 | CC: | daniel_megert, snorthov | ||||||
| Version: | 3.3 | ||||||||
| Target Milestone: | 3.3 M5 | ||||||||
| Hardware: | PC | ||||||||
| OS: | Windows XP | ||||||||
| Whiteboard: | |||||||||
| Bug Depends on: | 168524 | ||||||||
| Bug Blocks: | |||||||||
| Attachments: |
|
||||||||
|
Description
Benno Baumgartner
Created attachment 57067 [details]
screen shot
Can reproduce (also with normal text editor). This looks like the same problem as we had with the vertical positioning (see bug 168429). Moving to SWT for comments. Created attachment 57243 [details]
Picture showing wrong horizontal thumb
This can confuse users. A fix for M5 would be great. Felipe, it is our problem? Note that it sometimes works. It depends where the caret is but I could not yet figure out the pattern. Two things I observe which might help to track this down: 1. it seems to happen when the selection is at a position that normally doesn't require to scroll in order to see it. 2. only the very first editor restored by the platform is affected. The reason why it doesn't work for the very first one is captured in bug 168524. This might give you a hint. Daniel, I fixed StyledText to honour setHorizontalOffset (the thumb of the scrollbar is correct). However the text is still scroll to the right because you are calling the API. fixed in HEAD > 20070206 I'll have to check why we call it in this scenario. Probably because the widget isn't fully visible yet and hence we use wrong numbers to compute the index. Can you release this into the map file for I20070207-0010 so that I can test this tomorrow along with the other SWT contributions that aren't in I20070206-0010? (In reply to comment #11) > Can you release this into the map file for I20070207-0010 so that I can test > this tomorrow along with the other SWT contributions that aren't in > I20070206-0010? you got it. The problem is that fTextWidget.getClientArea().width returns 0 and hence my computation is wrong and assumes it needs to call setHorizontalIndex(int). Is there any way (besides Platform UI fixing bug 168524) that StyledText can return the "correct" width in this scenario? What are the bounds of the control when you ask for the client area? Rectangle {29, 0, 0, 0}
The width and height are zero. How can the client area be anything else? I guess there's nothing that SWT or Text can do than wait for the Platform to make sure the part is indeed activated when they send partActivated. This is the old classic bug/feature that every text control on every operating system has had since the beginning of time. Is goes like this:
0) The text control is created (size is zero)
1) The text control state is configured
- the selection or the left index is set
- this causes the control to scroll horizontally
2) The text control is resized
- if this were done first, the scrolling in 1) would not be necessary
- the text control can't know to undo the scrolling
- it could have been the user and the scrolling should not change
We can help you fix this and/or work around it. Where is the code?
I think the code that is responsible is the one in the workbench that does the intial startup and causes its components to be layouted before the window has a size i.e. all controls in a view or editor are affected by this. Here is where the 0-bounds are set: Thread [main] (Suspended (breakpoint at line 2312 in Control)) owns: RunnableLock (id=444) StyledText(Control).setBounds(int, int, int, int, int) line: 2312 StyledText(Control).setBounds(int, int, int, int) line: 2308 SourceViewer$RulerLayout.layout(Composite, boolean) line: 136 Canvas(Composite).updateLayout(boolean, boolean) line: 987 Canvas(Composite).layout(boolean, boolean) line: 531 Canvas(Composite).layout(boolean) line: 496 CompositeRuler.layoutTextViewer() line: 609 CompositeRuler.addDecorator(int, IVerticalRulerColumn) line: 563 AbstractTextEditor$11.run() line: 1572 SafeRunner.run(ISafeRunnable) line: 37 AbstractDecoratedTextEditor$1(AbstractTextEditor$ColumnSupport).addColumn(CompositeRuler, RulerColumnDescriptor) line: 1575 AbstractDecoratedTextEditor$1(AbstractTextEditor$ColumnSupport).setColumnVisible(RulerColumnDescriptor, boolean) line: 1559 TextEditor(AbstractTextEditor).updateContributedRulerColumns(CompositeRuler) line: 2758 TextEditor(AbstractTextEditor).createPartControl(Composite) line: 3028 TextEditor(StatusTextEditor).createPartControl(Composite) line: 53 TextEditor(AbstractDecoratedTextEditor).createPartControl(Composite) line: 373 EditorReference.createPartHelper() line: 662 EditorReference.createPart() line: 421 EditorReference(WorkbenchPartReference).getPart(boolean) line: 586 EditorAreaHelper.setVisibleEditor(IEditorReference, boolean) line: 263 EditorManager.setVisibleEditor(IEditorReference, boolean) line: 1510 EditorManager$5.runWithException() line: 1044 EditorManager$5(StartupThreading$StartupRunnable).run() line: 31 RunnableLock.run() line: 35 UISynchronizer(Synchronizer).runAsyncMessages(boolean) line: 123 Display.runAsyncMessages(boolean) line: 3467 Display.readAndDispatch() line: 3107 Workbench.runUI() line: 2187 Workbench.access$4(Workbench) line: 2103 Workbench$4.run() line: 457 Realm.runWithDefault(Realm, Runnable) line: 289 Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 452 PlatformUI.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 149 IDEApplication.start(IApplicationContext) line: 101 EclipseAppHandle.run(Object) line: 146 EclipseAppLauncher.runApplication(Object) line: 106 EclipseAppLauncher.start(Object) line: 76 EclipseStarter.run(Object) line: 354 EclipseStarter.run(String[], Runnable) line: 169 NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method] NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39 DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25 Method.invoke(Object, Object...) line: 585 Main.invokeFramework(String[], URL[]) line: 476 Main.basicRun(String[]) line: 416 Main.run(String[]) line: 1124 Main.main(String[]) line: 1099 Here is where the correct bounds are set (too late): Thread [main] (Suspended (breakpoint at line 2312 in Control)) owns: RunnableLock (id=757) StyledText(Control).setBounds(int, int, int, int, int) line: 2312 StyledText(Control).setBounds(int, int, int, int) line: 2308 SourceViewer$RulerLayout.layout(Composite, boolean) line: 136 Canvas(Composite).updateLayout(boolean, boolean) line: 987 Canvas(Composite).WM_SIZE(int, int) line: 1279 Canvas.WM_SIZE(int, int) line: 303 Canvas(Control).windowProc(int, int, int, int) line: 3545 Display.windowProc(int, int, int, int) line: 4159 OS.DefWindowProcW(int, int, int, int) line: not available [native method] OS.DefWindowProc(int, int, int, int) line: 2195 Canvas(Scrollable).callWindowProc(int, int, int, int) line: 77 Canvas(Control).windowProc(int, int, int, int) line: 3562 Display.windowProc(int, int, int, int) line: 4159 OS.SetWindowPos(int, int, int, int, int, int, int) line: not available [native method] Canvas(Widget).SetWindowPos(int, int, int, int, int, int, int) line: 1235 Canvas(Control).setBounds(int, int, int, int, int, boolean) line: 2330 Canvas(Control).setBounds(int, int, int, int, int) line: 2312 Canvas(Control).setBounds(int, int, int, int) line: 2308 FillLayout.layout(Composite, boolean) line: 198 Composite.updateLayout(boolean, boolean) line: 987 Composite.WM_SIZE(int, int) line: 1279 Composite(Control).windowProc(int, int, int, int) line: 3545 Display.windowProc(int, int, int, int) line: 4159 OS.DefWindowProcW(int, int, int, int) line: not available [native method] OS.DefWindowProc(int, int, int, int) line: 2195 Composite(Scrollable).callWindowProc(int, int, int, int) line: 77 Composite(Control).windowProc(int, int, int, int) line: 3562 Display.windowProc(int, int, int, int) line: 4159 OS.SetWindowPos(int, int, int, int, int, int, int) line: not available [native method] Composite(Widget).SetWindowPos(int, int, int, int, int, int, int) line: 1235 Composite(Control).setBounds(int, int, int, int, int, boolean) line: 2330 Composite(Control).setBounds(int, int, int, int, int) line: 2312 Composite(Control).setBounds(int, int, int, int) line: 2308 Composite(Control).setBounds(Rectangle) line: 2377 StackLayout.layout(Composite, boolean) line: 116 Composite.updateLayout(boolean, boolean) line: 987 Composite.WM_SIZE(int, int) line: 1279 Composite(Control).windowProc(int, int, int, int) line: 3545 Display.windowProc(int, int, int, int) line: 4159 OS.DefWindowProcW(int, int, int, int) line: not available [native method] OS.DefWindowProc(int, int, int, int) line: 2195 Composite(Scrollable).callWindowProc(int, int, int, int) line: 77 Composite(Control).windowProc(int, int, int, int) line: 3562 Display.windowProc(int, int, int, int) line: 4159 OS.SetWindowPos(int, int, int, int, int, int, int) line: not available [native method] Composite(Widget).SetWindowPos(int, int, int, int, int, int, int) line: 1235 Composite(Control).setBounds(int, int, int, int, int, boolean) line: 2330 Composite(Control).setBounds(int, int, int, int, int) line: 2312 Composite(Control).setBounds(int, int, int, int) line: 2308 FillLayout.layout(Composite, boolean) line: 198 Composite.updateLayout(boolean, boolean) line: 987 Composite.WM_SIZE(int, int) line: 1279 Composite(Control).windowProc(int, int, int, int) line: 3545 Display.windowProc(int, int, int, int) line: 4159 OS.DefWindowProcW(int, int, int, int) line: not available [native method] OS.DefWindowProc(int, int, int, int) line: 2195 Composite(Scrollable).callWindowProc(int, int, int, int) line: 77 Composite(Control).windowProc(int, int, int, int) line: 3562 Display.windowProc(int, int, int, int) line: 4159 OS.SetWindowPos(int, int, int, int, int, int, int) line: not available [native method] Composite(Widget).SetWindowPos(int, int, int, int, int, int, int) line: 1235 Composite(Control).setBounds(int, int, int, int, int, boolean) line: 2330 Composite(Control).setBounds(int, int, int, int, int) line: 2312 Composite(Control).setBounds(int, int, int, int) line: 2308 FillLayout.layout(Composite, boolean) line: 198 Composite.updateLayout(boolean, boolean) line: 987 Composite.WM_SIZE(int, int) line: 1279 Composite(Control).windowProc(int, int, int, int) line: 3545 Display.windowProc(int, int, int, int) line: 4159 OS.DefWindowProcW(int, int, int, int) line: not available [native method] OS.DefWindowProc(int, int, int, int) line: 2195 Composite(Scrollable).callWindowProc(int, int, int, int) line: 77 Composite(Control).windowProc(int, int, int, int) line: 3562 Display.windowProc(int, int, int, int) line: 4159 OS.EndDeferWindowPos(int) line: not available [native method] Composite.resizeChildren(boolean, WINDOWPOS[]) line: 703 Composite.resizeChildren() line: 669 Composite.setResizeChildren(boolean) line: 875 Composite.WM_SIZE(int, int) line: 1283 Composite(Control).windowProc(int, int, int, int) line: 3545 Display.windowProc(int, int, int, int) line: 4159 OS.DefWindowProcW(int, int, int, int) line: not available [native method] OS.DefWindowProc(int, int, int, int) line: 2195 Composite(Scrollable).callWindowProc(int, int, int, int) line: 77 Composite(Control).windowProc(int, int, int, int) line: 3562 Display.windowProc(int, int, int, int) line: 4159 OS.SetWindowPos(int, int, int, int, int, int, int) line: not available [native method] Composite(Widget).SetWindowPos(int, int, int, int, int, int, int) line: 1235 Composite(Control).setBounds(int, int, int, int, int, boolean) line: 2330 Composite(Control).setBounds(int, int, int, int, int) line: 2312 Composite(Control).setBounds(int, int, int, int) line: 2308 Composite(Control).setBounds(Rectangle) line: 2377 EditorSashContainer(PartSashContainer).setBounds(Rectangle) line: 855 LayoutTree.doSetBounds(Rectangle) line: 547 LayoutTree.setBounds(Rectangle) line: 538 LayoutTreeNode.doSetBounds(Rectangle) line: 534 LayoutTreeNode(LayoutTree).setBounds(Rectangle) line: 538 LayoutTreeNode.doSetBounds(Rectangle) line: 503 LayoutTreeNode(LayoutTree).setBounds(Rectangle) line: 538 LayoutTreeNode.doSetBounds(Rectangle) line: 535 LayoutTreeNode(LayoutTree).setBounds(Rectangle) line: 538 LayoutTreeNode.doSetBounds(Rectangle) line: 503 LayoutTreeNode(LayoutTree).setBounds(Rectangle) line: 538 ViewSashContainer(PartSashContainer).resizeSashes() line: 814 ViewSashContainer(PartSashContainer).setActive(boolean) line: 532 PerspectiveHelper.activate(Composite) line: 248 Perspective.onActivate() line: 841 WorkbenchPage.onActivate() line: 2421 WorkbenchWindow$20.run() line: 2717 BusyIndicator.showWhile(Display, Runnable) line: 67 WorkbenchWindow.setActivePage(IWorkbenchPage) line: 2698 WorkbenchWindow$15.runWithException() line: 2053 WorkbenchWindow$15(StartupThreading$StartupRunnable).run() line: 31 RunnableLock.run() line: 35 UISynchronizer(Synchronizer).runAsyncMessages(boolean) line: 123 Display.runAsyncMessages(boolean) line: 3467 Display.readAndDispatch() line: 3107 Workbench.runUI() line: 2187 Workbench.access$4(Workbench) line: 2103 Workbench$4.run() line: 457 Realm.runWithDefault(Realm, Runnable) line: 289 Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 452 PlatformUI.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 149 IDEApplication.start(IApplicationContext) line: 101 EclipseAppHandle.run(Object) line: 146 EclipseAppLauncher.runApplication(Object) line: 106 EclipseAppLauncher.start(Object) line: 76 EclipseStarter.run(Object) line: 354 EclipseStarter.run(String[], Runnable) line: 169 NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method] NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39 DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25 Method.invoke(Object, Object...) line: 585 Main.invokeFramework(String[], URL[]) line: 476 Main.basicRun(String[]) line: 416 Main.run(String[]) line: 1124 Main.main(String[]) line: 1099 I think an easier "fix" for the platform would be to ensure that they do not send out partActivated until the part is realized (bug 168524). Steve I think for book keeping we should reopen this bug, give it to Platform UI and mark it as dup of bug 168524. Go ahead. . Platform Text has released a workaround for M5. *** This bug has been marked as a duplicate of bug 168524 *** >Platform Text has released a workaround for M5. Removed workaround as bug 168524 is now fixed. Available in builds > N20080417-2000. |