Loading ...
Sorry, an error occurred while loading the content.
 

Re: winrestview() + 'showcmd'

Expand Messages
  • Yakov Lerner
    ... Thanks, the patch fixes it. Yakov
    Message 1 of 3 , Sep 5, 2006
      On 9/5/06, Bram Moolenaar <Bram@...> wrote:
      >
      > 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
      >

      Thanks, the patch fixes it.

      Yakov
    Your message has been successfully submitted and would be delivered to recipients shortly.