Yakov Lerner wrote: > I see erratic screen redraw (namely, curshor shown > past last line of file, or on wrong line (which is not line('.'))). > This vim 7.0.86 taken from svn today, including recent > fix to winrestcmd(). > > It happens after certain winrestview() when 'showcmd' is set. > This code works ok with 'noshowcmd'. (It took me a while to > track this down to 'showcmd' option specifically. The > context of this code is, I want to make "scrollfix" plugin which > locks cursor at Nth visual line, Nth line from top of screen). > > To reproduce: > > 1. First, let's see how it works ok > vim -u NONE -c 'so x.vim' x.vim > press <Down> to end of file to see how it works ok. > G gg G gg " works ok > > 2. With 'showcmd', same code works very differently: > > vim -u NONE -c 'so x.vim' x.vim > :set showcmd " this turns on the problem > :set nu ruler statusline= laststatus=2 " this to watch the > " line number mismatch > press <Down> repeatedly till eof > BUG1: notice cursor draw past eof > <Up> > BUG2: now notice the cursor is in line 25 but > ':echo line(".")' shows line 26 > ggG > BUG3: Now cursor is totally off-limits > > Note that ':echo g:last' allows to see the dict > used in last winrestview() thanks to 'let g:last = dict' > line in x.vim.
Thanks for the clear explanation. It seems this patch fixes the problem: *** ../vim-7.0.090/src/eval.c Tue Sep 5 12:57:14 2006 --- src/eval.c Tue Sep 5 21:21:37 2006 *************** *** 16225,16231 **** curwin->w_curswant = get_dict_number(dict, (char_u *)"curswant"); curwin->w_set_curswant = FALSE; ! curwin->w_topline = get_dict_number(dict, (char_u *)"topline"); #ifdef FEAT_DIFF curwin->w_topfill = get_dict_number(dict, (char_u *)"topfill"); #endif --- 16225,16231 ---- curwin->w_curswant = get_dict_number(dict, (char_u *)"curswant"); curwin->w_set_curswant = FALSE; ! set_topline(curwin, get_dict_number(dict, (char_u *)"topline")); #ifdef FEAT_DIFF curwin->w_topfill = get_dict_number(dict, (char_u *)"topfill"); #endif -- "A mouse can be just as dangerous as a bullet or a bomb." (US Representative Lamar Smith, R-Texas) /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ download, build and distribute -- http://www.A-A-P.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///