On 14:23 Fri 09 Jan , Charles Campbell wrote: > Bram Moolenaar wrote: > > 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. > > > Actually :wincmd <, >, and | are column oriented, not line oriented. > So, sometimes its window oriented, line oriented, or column oriented. I > guess that means we need new window commands that are buffer oriented > and tab oriented just to make things maximally difficult! :) > > Regards, > Chip
Yes that's a problem. Bram maybe we should:
- add a special range type `ADDR_POSTPONED`
- for commands which have it we could store the range on `exarg_T`
struct
- parse it when we know how to do it, in this case inside the
`do_window` function; for that we could factor out the range
parsing code from `do_one_cmd` into a seprate function and use
inside `do_window`.
Best regards,
Marcin
--
--
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.
signature.asc
Description: Digital signature
