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.

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

/^-- Ingo Karkat -- /^-- /^-- /^-- /^-- /^-- /^-- http://ingo-karkat.de/ --

             The Martian canals were the Martians' last ditch effort.

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

Raspunde prin e-mail lui