62

When I scroll to the bottom of an open document in the Eclipse editor, the last line is at the bottom of the file. This is a tad annoying when editing code at the bottom of the file / screen.

How can I enable Eclipse to scroll (much like Vim or VS) down far enough that the last line of code reaches the top of the editor window?

I'm asking for the reverse of this question, in Eclipse: How to make Visual Studio editor stop scrolling past bottom of a file?

6
  • I don't get why is this annoying..
    – Bozho
    Feb 4, 2010 at 7:19
  • 29
    Its annoying to many people. Editing closer to the center of the window is easier on the eyes, at least in my experience.
    – RHSeeger
    Feb 4, 2010 at 15:40
  • That's basically my problem, eye irritation. I'm in front of the screen for 8+ hrs a day so it makes a difference. It's not a massive problem though, more like the difference between using a white-on-black theme vs black-on-white. Feb 5, 2010 at 1:18
  • 2
    I just tweeted this same complaint before searching and finding your question. I came to Eclipse from Emacs and subtle things like this are disappointing.
    – andykellr
    Apr 22, 2011 at 15:10
  • Netbeans is also a great IDE ;-) Aug 29, 2015 at 22:42

1 Answer 1

38

Considering the current implementation of a Scrollbar, this is not possible.
(See org.eclipse.swt.widgets.ScrollBar.java)

At any given moment, a given scroll bar will have a single 'selection' that is considered to be its value, which is constrained to be within the range of values the scroll bar represents (that is, between its minimum and maximum values).

In the JDT (Java Editor) realm, the range is strongly linked to the number of lines a source file has.
Adding artificial "logical lines" to allows scrolling past the last line would have unintended consequences on many other parts of the JDT, related to displaying informations based on the line number of a source file (like a compilation error red underline).

This is also why there is no soft wrapping in those editors, despite a 7-years old bug 35779 (one of the most upvoted).

Allowing word/soft wrap in the editor while typing is easy but not enough, a mapping between the model lines and the visual lines must be introduced to e.g. correctly show annotations.
It also introduces various problems that need to be solved, e.g. 'Go to Line': tools like a debugger, compiler etc. will report the model line but a user it will look strange that a different line will be selected than the one entered into the 'Go to Line' dialog

So for now, the SWT scrollbar example is still limited by the bottom of the window:

http://www.java2s.com/Code/JavaImages/ScrollBarExample.PNG

6
  • 25
    Those are extremely lame excuses from the eclipse team. Every decent editors supports those features.
    – Palesz
    Jul 7, 2012 at 16:54
  • 4
    Totally agree. Very old issue and still no resolution. Aug 24, 2012 at 13:18
  • 5
    Darn.I assume 4 years later there is still no resolution Oct 26, 2014 at 19:57
  • 3
    I don't get why they can't fix this. Can't they just plug in a new TextLineControllerFactory? I thought that's how you do it in Java :)
    – mafu
    Oct 24, 2015 at 11:22
  • 1
    @OldBadmanGrey .. did he say 3 years ago ... ;] Still nothing. I wonder as well. this doesn't even have to do with the scrollbar! The feature is only visual convenience. In fact: If there are fewer lines than the view is long or lines are collapsed the eclipse text view DOES already show a nice empty space down till the bottom.
    – ewerybody
    Jan 11, 2018 at 14:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.