--- "A.J.Mechelynck" <[EMAIL PROTECTED]> wrote:
> Thomas Mellman wrote:
> >   When moving from buffer to buffer using
> >   the :bp and :bn commands, vim normally positions the file and cursor
> >   such that the last line visited is presented in the middle of the
> >   screen and the cursor is on that line.
> > 
> >   In certain circumstances, however, it does not do this.  In those
> >   circumstances, when one opens the file, the cursor is indeed placed
> >   on the last line visited - but that line is positioned at the bottom
> >   of the window.
> > 
> >   This apparently only happens when syntax is on - but for all (tested)
> >   syntaxes.
> > 
> >   Now, in particular, this happens if the cursor is positioned on the
> >   line of the file that falls within a range starting at the window
> >   height.  The extent of this range appears to be a function of the file
> >   length - for example, in one case, the window height is 70 lines.  The
> >   range causing the problem starts at line 70 of the file and - for very
> >   long files - extents to line 104.  When the cursor is place on line 105,
> >   moving into the buffer causes the last line to be positioned in the
> >   middle of the window.  When the cursor is placed on line 104, reentering
> >   the buffer puts the line at the bottom of the window.
> > 
> >   In this particular case, if the file is longer than 104
> >   lines but shorter than 139 lines, the event happens anywhere after
> >   line 69 - but note that only lines 35-104 would be required to display
> >   line 70 in the middle of the window.
> 
> See ":help 'scrolloff'".
> 
> Setting 'scrolloff' to a large number (large enough to always be larger 
> than half the value of 'lines') will always keep the cursor line near 
> the middle of the screen, except when it is in the very first or last 
> few lines of the file (e.g., the first line of the file will never start 
> "lower" than the first line of the window).

This method seems to change the behaviour of the cursor so that cursor stays
in middle of the screen and the file moves.  That's something different.

What I'm seeing is clearly a bug, because vim behaves in a non-logical
manner.  There's some problem with the positioning algorithm with respect
to window and file boundaries.

There's no reason for the cursor to dive to the bottom of the window in
certain positional situations and not in others.

Now, it's clear - if there's not enough lines to position the cursor in
the center of the screen, it would be logical that the line couldn't be
positioned in the middle.  But that's not the problem.
The problem happens when there *are* enough lines.


> You could also use z. (zed-fullstop or zee-period depending on your 
> flavour of English) in Normal mode, to move "just once" the cursor line 
> to the middle.


Ah, what do you mean with "just once"?  That's exactly the problem: I
have to z. everytime I visit the file.  If I'm comparing a pivot spot
in 5 files (the source code, the data output, the include file definition,
the specification document, and my notes file, for example), certain files
- at certain positions - will have to be z.-ed every time they're revisited.



__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Reply via email to