Saturday, February 8, 2014

Re: Cursor beyond last line

diff --git a/src/move.c b/src/move.c
--- a/src/move.c
+++ b/src/move.c
@@ -2101,6 +2101,7 @@
int used;
lineoff_T loff;
lineoff_T boff;
+ linenr_T old_topline = curwin->w_topline;

loff.lnum = boff.lnum = curwin->w_cursor.lnum;
#ifdef FEAT_FOLDING
@@ -2156,6 +2157,9 @@
curwin->w_topline = topline;
#ifdef FEAT_DIFF
curwin->w_topfill = topfill;
+ if (old_topline > curwin->w_topline + curwin->w_height
+ && curwin->w_botfill)
+ curwin->w_botfill = FALSE;
check_topfill(curwin, FALSE);
#endif
curwin->w_valid &= ~(VALID_WROW|VALID_CROW|VALID_BOTLINE|VALID_BOTLINE_AP);
On Fr, 07 Feb 2014, mvxxc@gmx.de wrote:

> Hello Vim users,
>
> can someone confirm the following strange procedure to place the cursor beyond
> the last line? Seems like a problem with relative offets used by the
> 'scrollbind' option (":h scrollbind-relative").
>
> (1) Create two windows, split vertically, with following contents.
>
> Left window:
> 100 lines containing "1"
> 100 lines containing "-"
> 100 lines containing "1"
> 100 lines containing "-"
> 100 lines containing "1"
> 100 lines containing "-"
>
> Right window:
> 50 lines containing "2"
> 450 lines containing "-"
>
> (2) Switch on diff mode for both windows.
>
> (3) Go to the last line in the left window.
>
> (4) Change to the right window.
>
> The cursor is now located one line below the last line in the right window.
>
> Corresponding commands:
> (1)-(3)
> :exe "norm 50o2\e450o-\eggdd"
> :difft
> :vne
> :exe "norm 100o-\e100o1\eggddyG2PG"
> :difft
> (4) (must be separate)
> :winc l
>
> Thanks!

That is a bug. Problem is, curwin->w_botfill is not updated correctly
and so the win_line function aborts too early. Funny thing is, the
cursor is actually on the correct line, it's just that the drawing
functions forget to draw a line, so the cursor placement looks wrong.

Attached is a patch.

Best,
Christian
--
Academicians care, that's who.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: