On 2015-01-28, Xavier de Gaye wrote: > On 01/27/2015 01:29 PM, Bram Moolenaar wrote: > > > > Xavier de Gaye wrote: > > > >> Running the DirDiff plugin with the latest 7.4.592 produces the following > >> error message: > >> > >> E16: Invalid range: 3wincmd > >> > >> This occurs since 7.4.565. > >> There are other related reports, for example the thread ":wincmd bug" at > >> http://thread.gmane.org/gmane.editors.vim.devel/48814 > >> I guess this is being worked on and just wanted to report that DirDiff > >> is also broken. > > > > Is the problem that the plugin is using a non-existing window number or > > is the range check wrong? > > > > > Yes, the plugin is using a non-existing window. > The following patch to DirDiff seems to fix the problem. > > This plugin is very nice. I am using it with mercurial with the > command 'hg vim' to browse all the changes made between revisions > or in the workarea. > FWIW the corresponding configuration in my .hgrc configuration is: > > [extdiff] > # DirDiff script for Vim: http://www.vim.org/scripts/script.php?script_id=102 > # wget http://www.vim.org/scripts/download_script.php?src_id=5306 -O > ~/.vim/plugin/DirDiff.vim > cmd.vimdiff = gvim > opts.vimdiff = -f '+next' '+execute "DirDiff" argv(0) argv(1)' > > > And here is my DirDiff patch to the latest VERSION: 1.1.4: > > diff --git a/plugin/DirDiff.vim b/plugin/DirDiff.vim > --- a/plugin/DirDiff.vim > +++ b/plugin/DirDiff.vim > @@ -540,12 +540,12 @@ > > " Save the number of this window, to which we wish to return > " This is required in case there are other windows open > - let thisWindow = winnr() > + " let thisWindow = winnr() > > call <SID>CloseDiffWindows() > > " Ensure we're in the right window > - exec thisWindow.'wincmd w' > + " exec thisWindow.'wincmd w' > > let line = getline(".") > " Parse the line and see whether it's a "Only in" or "Files Differ"
Doesn't that patch break the ability of the plugin to return to the "right" window after closing the diff windows? I think a better solution is to change the second -'d line from exec thisWindow.'wincmd w' to silent! exec thisWindow.'wincmd w' The plugin has probably always tried moving the cursor to an invalid window number without causing any apparent problems. The only difference since 7.4.565 is the error message, which the :silent! inhibits. Regards, Gary -- -- You received this message from the "vim_dev" 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_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.