Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 361101

Summary: [navigation] Scroll to same position when opening declaration.
Product: [Eclipse Project] JDT Reporter: Kenneth Styrberg <kenneth>
Component: TextAssignee: JDT-Text-Inbox <jdt-text-inbox>
Status: RESOLVED WONTFIX QA Contact:
Severity: enhancement    
Priority: P3 CC: daniel_megert, markus.kell.r
Version: 3.7.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Kenneth Styrberg CLA 2011-10-17 04:24:07 EDT
Build Identifier: 

When pressing 'F3' on a class method to open the declaration, the position on screen should be on same line where pressed to avoid moving eye focus.

Ex. If the class method call is 5 lines down in editor, pressing 'F3' on method call should open up the class and put the method definition five lines down in editor, at same position as in caller class. 

Hmm it's really hard to explain but maybe it's clear?



Reproducible: Always
Comment 1 Markus Keller CLA 2011-10-17 08:58:32 EDT
I see what you mean, but I disagree in the case where the jump target is already visible in the current editor. Then it's better to keep the visible viewport stable and just change the selection. Otherwise, the jumping would destroy the mental image of the user, and the forced re-orientation is worse than having to move the eyes.

In cases where the clicked identifier is close to the top or the bottom of the editor, scrolling the jump target to the same screen location is also problematic, since you often wouldn't see enough context then (Javadoc on top, implementation at the bottom).

Kenneth, maybe you want to bind the "Recenter" command to a keyboard shortcut. Whenever you invoke this, the current text line gets centered vertically, so you know where to start reading.

Dani, I suggest to close as wontfix.
Comment 2 Dani Megert CLA 2011-10-17 11:23:26 EDT
> Dani, I suggest to close as wontfix.
I agree.
Comment 3 Kenneth Styrberg CLA 2011-10-18 13:36:28 EDT
Ok, I agree for not moving text in an active editor. But when editor opens up new class files, I think placing the line at previous position makes eye movement less strainful. This is regardless of javadoc text and position in editor.

Maybe I shall check the source and see if I can test this myself...
Comment 4 Markus Keller CLA 2011-10-18 14:38:36 EDT
> Maybe I shall check the source and see if I can test this myself...

Feel free to make some experiments. TextViewer#internalRevealRange(int, int) scrolls the target line to about 1/3 of the editor height.