Ingo Karkat wrote:

> Hello VIM developers,
> 
> I found a small bug in :pedit when one wants to clone the current
> buffer to the preview window _and_ there is a :autocmd for the
> 'BufReadPre' event; in that case, the cursor jumps to the first line
> of the original window instead of remaining at the same position.
> In my case, the bug manifests itself due to DrChip's 'LargeFile.vim'
> plugin (vimscript#1506), which defines an ':au BufReadPre *'. I was
> working on an elaborate mapping that included ':pedit %' and relied on
> the cursor not moving.
> 
> Steps to reproduce:
> 
> gvim -N -u NONE
> " Just open a file with a couple of lines and go to the end.
> :e + $VIMRUNTIME/vimrc_example.vim
> :echo line('.')
> 94
> :pedit %
> :echo line('.')
> 94
> " Okay, still at the end.
> :pclose
> :au BufReadPre * let g:isExecuted = 1
> :pedit %
> " By now, the cursor has jumped to the first line in the original window;
> " the same happens with :pedit, but not with :pedit <any other file>.
> :echo line('.')
> 1
> " The help says the cursor position shouldn't change.
> :help :pedit
> [...] The current window and cursor position isn't changed.
> 
> I can reproduce this with VIM 7.1 on Windows and with VIM 7.2a.10 (Big
> version) on openSUSE 10.3/x86.

I can reproduce it.  I'll add a remark to the todo list.

> -- best regards, ingo
> 
> PS: I rewrote my mapping to use bufnr() / :buffer to open the same
> file in the preview window; but now I have to work around the fact
> that there is no :popen command to open a blank preview window. Why is
> that one missing?

Why would you want to preview nothing?

-- 
hundred-and-one symptoms of being an internet addict:
128. You can access the Net -- via your portable and cellular phone.

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

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui