Friday, April 29, 2011

Re: ":windo g/pattern/q" peculiarity

On 04/28/2011 09:49 PM, Jean-Rene David wrote:
> * Tim Chase [2011.04.28 14:40]:
>> Because each of your files have the same number of lines, it doesn't
>> register a change. For a full example:
>>
>> bash$ cd ~/tmp; mkdir moreless; cd moreless
>> bash$ for i in 10 20 30 40 50; do seq $i> ${i}.txt ; done
>> bash$ sed -i '5s/$/@/' 30.txt
>> bash$ sed -i '10s/$/@/' 50.txt
>> bash$ vim -o *.txt
>> :windo g/@/q
>
> Got it now.
>
> The problem is that the :g command just subtracts the number of lines in
> the buffer where it starts from the number of lines in the buffer where
> it ends to produce that message.
>
> Of course it assumes those two buffers are the same but it doesn't
> *check* that it is so.

That's sorta what I figured, as I mentioned in my original post:

TKC> lines before the ":g" and comparing it to number of lines after
TKC> the ":g", and reporting the difference, but not noticing
that the
TKC> file/buffer/window had changed in the process.

Thanks for throwing together a patch.

-tim

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