Sunday, June 3, 2018

Re: First line starting with space affects cursor position when switching buffers

On Saturday, 2 June 2018 02:29:42 UTC-5, Bram Moolenaar wrote:
> Andy Wokula wrote:
>
> > Am 01.06.2018 um 08:25 schrieb dmccooey@comcast.net:
> > > Hello,
> > >
> > > I have encountered what appears to be a bug in vim,
> > > but it might be a feature that I would like to disable.
> > >
> > > To reproduce the problem:
> > >
> > > Use vim to create a new file, and add 10 or so lines of text to the file.
> > > In the first line, put at least two characters, and make sure the first character is a space or tab.
> > > Place the cursor on the last line (or any line other than the first line).
> > > Save the file (:w) and switch (:e) to view another file.
> > > Switch back (:e) to the original file.
> > > Notice that the cursor is on the first line, not where it was originally.
> > >
> > > I am using vim 8.0 for Mac.
> > >
> > > Dave McCooey
> >
> > I've seen this too for a long time (before v8.0), but didn't bother to investigate ...
> > It's easy to "fix": just don't start the first line with whitespace.
> >
> > Ok, I did some bisecting (first time ^^):
> >
> > gvim-v7-4-674.exe (and earlier) works ok
> > gvim-v7-4-675.exe (and later) shows the bug
> >
> > Someone should take a look at Patch 7.4.675
>
> That patch looks fine.
>
> Vim normally puts the cursor in the first line. There must be an
> autocommand that is moving it to the last used position, the problem is
> most likely in that autocommand.
>
> You can use $VIMRUNTIME/macros/editexisting.vim
>
> --
> hundred-and-one symptoms of being an internet addict:
> 16. You step out of your room and realize that your parents have moved and
> you don't have a clue when it happened.
>
> /// 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 ///

Hello Bram,

When switching back and forth between two files using :e#,
and assuming there are no autocommands involved, does vim
normally put the cursor in the first line after each switch?

I ask because I don't have autocommands involved, and I don't
see vim behaving this way.

There may be some confusion in this thread, because Christoph's
reply referred to the case where a file is being opened for the
first time. My post is not about that case. When I open a
file for the first time, I expect vim to put the cursor in the
first line (and it does).

Dave

--
--
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/d/optout.

No comments: