Sung Pae wrote:

> On Thu  8 Jan 2015 at 05:15:55PM -0600, guns wrote:
> > On Thu  8 Jan 2015 at 03:06:45PM -0800, Amadeus Demarzi wrote:
> > > Using vim with patches 1-567 I get a range error when calling wincmd in 
> > > certain contexts:
> > >
> > > vim -u NONE
> > > :split
> > > :wincmd+ # works as expected
> > > :2wincmd+ # also works as expected
> > > :3wincmd+ # throws the error: Invalid Range
> > >
> > > In fact, any value above 2 seems to throw this error.
> 
> > Just a guess; I was planning on looking into it tonight.
> 
> The problem is indeed introduced in 7.4.565. In particular:
> 
> --- a/src/ex_cmds.h
> +++ b/src/ex_cmds.h
> @@ -1574,7 +1574,7 @@ EX(CMD_winsize,         "winsize",      ex_winsize,
>                       ADDR_LINES),
>  EX(CMD_wincmd,               "wincmd",       ex_wincmd,
>                       NEEDARG|WORD1|RANGE|NOTADR,
> -                     ADDR_LINES),
> +                     ADDR_WINDOWS),
>  EX(CMD_windo,                "windo",        ex_listdo,
>                       BANG|NEEDARG|EXTRA|NOTRLCOM,
>                       ADDR_LINES),
> 
> I think the author of the patch forgot about:
> 
>     :wincmd +
>     :wincmd -
>     :wincmd <
>     :wincmd >
>     :wincmd n
>     :wincmd s
>     :wincmd v
>     :wincmd |
> 
> which all interpret the [count] as a number of lines, and not a number
> of windows.
> 
> I suppose the preceding commands could be spared the bounds check, but
> as long as Ctrl-W commands are spared from the checks as well¹, I would
> advocate just reverting the hunk above.
> 
>     guns
> 
> ¹ :execute "normal! 100\<C-w>+"

Yeah, this is getting complicated.  :wincmd can have different types of
ranges.  Using the line count is actually also wrong.
There probably is no other solution than postponing the range check
until the argument has been parsed.  That makes it difficult to give a
meaning to ":$wincmd".  Depending on the argument it can mean the last
window or the maximum size.

-- 
hundred-and-one symptoms of being an internet addict:
62. If your doorbell rings, you think that new mail has arrived.  And then
    you're disappointed that it's only someone at the door.

 /// Bram Moolenaar -- [email protected] -- 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    ///

-- 
-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui