Bug 178106 - [detail pane] Find action doesn't scroll to reveal selection
Summary: [detail pane] Find action doesn't scroll to reveal selection
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 trivial (vote)
Target Milestone: 3.3 M7   Edit
Assignee: Michael Rennie CLA
QA Contact:
URL:
Whiteboard:
Keywords: polish
: 179842 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-03-19 13:54 EDT by Curtis Windatt CLA
Modified: 2007-04-12 11:19 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Curtis Windatt CLA 2007-03-19 13:54:41 EDT
Build ID: I20070313-1051

In the default detail pane, the find/replace action does not scroll to reveal the selection when the find button is pressed.  Scrolling down manually will show that the correct element is selected.
Comment 1 Curtis Windatt CLA 2007-03-19 14:41:55 EDT
The internalRevealChange method in TextViewer is responsible for scrolling to the correct position.  This method is called with the proper offset.

However, when determining what line to scroll to, the result is always 0.  There are no line breaks in the text (so it is all one line), but text wrapping is turned on.
Comment 2 Michael Rennie CLA 2007-03-28 17:05:04 EDT
*** Bug 179842 has been marked as a duplicate of this bug. ***
Comment 3 Darin Wright CLA 2007-04-04 12:22:49 EDT
Curtis will investigate as M7 polish item. Not sure if we can do this with existing API when using SWT.WRAP in the text widget.
Comment 4 Curtis Windatt CLA 2007-04-04 16:57:25 EDT
Moving to Platform Text for comment

Looking at TextViewer the findAndSelect and findAndSelectInRange methods call setSelectionRange on the text widget and then call internalRevealRange to display the now selected text.  internalRevealRange does not work with wrapping on because all of the text is on one line.

By replacing the call to internalRevealRange with a call to showSelection on the text widget, the proper text is selected and the widget scrolls to the correct location.

Is it possible to change the TextViewer code to display the selection this way or will doing so break other functionality?


Comment 5 Dani Megert CLA 2007-04-04 17:42:11 EDT
Please see the TextViewer constructor's Javadoc. If you decide to use SWT.WRAP you have to provide your own implementation of IDocumentAdapter that takes care of such issues.

We can't change the reveal code.
Comment 6 Curtis Windatt CLA 2007-04-05 12:58:50 EDT
Fixed in HEAD

See DefaultDetailPane

Created a wrapper class for the find replace target that calls showSelection on the styled text after the findAndSelect method completes.
Comment 7 Curtis Windatt CLA 2007-04-05 12:59:05 EDT
Mike, please verify.
Comment 8 Michael Rennie CLA 2007-04-12 11:19:44 EDT
verified