Wednesday, May 2, 2012

Re: Cursor anomoly: apparent and actual positions differ

Christian Brabandt wrote:

> On Mo, 30 Apr 2012, John Beckett wrote:
>
> > I confirm there is a bug (Vim 7.3.509 on Windows).
> >
> > I slightly simplified the example to show the minimum that
> > demonstrates the problem, as below:
> >
> > " ----------- start bug.txt ------------------
> > " To show anomaly, launch Vim as:
> > " vim -N -u NONE bug.txt
> > " and enter:
> > " :so %
> > " :13
> > "
> > if v:version >= 700
> > au BufLeave * let b:winview = winsaveview()
> > au BufEnter * if exists('b:winview') | call winrestview(b:winview) | endif
> > endif
> > "
> > " Now enter:
> > " :copen
> > " CTRL-W CTRL-W
> > " Stop and see where cursor is, then press j
> > " which shows that cursor was NOT where it appeared to be.
> > " First pressing Ctrl-L or entering :redraw do not help.
> > " ----------- end bug.txt --------------------
> >
> > There is no problem if use ':new' or ':rightbelow new' instead
> > of ':copen'. Seems the quickfix window is part of problem.
> >
> > I can also see the problem if start Vim normally, then just yank
> > the two au commands and use :@" to source them, then enter
> > :copen Ctrl-W w. I have seen the cursor end up in the tildes
> > after end-of-file.
> >
> > Using ':echo b:winview' shows:
> > {'lnum': 13, 'leftcol': 0, 'col': 0, 'topfill': 0,
> > 'topline': 11, 'coladd': 0, 'skipcol': 0, 'curswant': 0}
> >
> > It looks like topline is wrong.
>
> Looks like a redraw issue to me. This fixes it for me:
> diff --git a/src/eval.c b/src/eval.c
> --- a/src/eval.c
> +++ b/src/eval.c
> @@ -18507,7 +18507,7 @@
> check_cursor();
> changed_cline_bef_curs();
> invalidate_botline();
> - redraw_later(VALID);
> + redraw_later(NOT_VALID);
>
> if (curwin->w_topline == 0)
> curwin->w_topline = 1;

Perhaps this should call changed_window_setting() instead of the
individual items marked as changed?

--
Close your shells, or I'll kill -9 you
Tomorrow I'll quota you
Remember the disks'll always be full
And then while I'm away
I'll write ~ everyday
And I'll send-pr all my buggings to you.
[ CVS log "Beatles style" for FreeBSD ports/INDEX, Satoshi Asami ]

/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

--
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

No comments: