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>+"

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

Attachment: pgpPT7woatS36.pgp
Description: PGP signature

Raspunde prin e-mail lui