On Mo, 25 Aug 2014, [email protected] wrote:

> Status: New
> Owner: ----
> Labels: Type-Defect Priority-Medium
> 
> New issue 252 by [email protected]: line() can move the cursor in a
> zero-height window
> https://code.google.com/p/vim/issues/detail?id=252
> 
> Minimal reproduction steps:
> 
> 1. vim -u NONE -U NONE -i NONE
> 2. :set winminheight=0
> 3. :autocmd! WinEnter * echom "ShowLine:" line('w0')
> 4. :new
> 5. :setlocal nowrap
> 6. a1<CR>2<CR>3<Esc>gg
> 7. <C-W>j<C-_>
> 8. <C-W>k<C-_>
> 
> 
> At this point, I expect the cursor to be on line 1, at the top of
> the screen.  Instead, the cursor is on line 3, at the top of the
> screen.
> 
> 
> The bug only manifests when the cursor is on the top line of the
> window before its height is reduced to zero, whether or not that
> line is the first in the file.  The matchparen plugin triggers this
> bug when the cursor is on a bracket within that line.  The cursor
> always ends up on the last line of the file, almost always with that
> line at the top of the screen.

This can be fixed by the following patch (but not sure, if this is the 
correct approach):

diff --git a/src/move.c b/src/move.c
--- a/src/move.c
+++ b/src/move.c
@@ -183,6 +183,10 @@ update_topline()
     if (!screen_valid(TRUE))
        return;
 
+    /* window invisible */
+    if (curwin->w_height == 0)
+       return;
+
     check_cursor_moved(curwin);
     if (curwin->w_valid & VALID_TOPLINE)
        return;


Best,
Christian
-- 
Alte Herren und Kometen werden aus dem gleichen Grund verehrt: 
Wegen ihrer langen Bärte und der Behauptung, daß sie die Ereignisse
voraussagen.
                -- Jonathan Swift

-- 
-- 
You received this message from the "vim_dev" 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_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui