Loading ...
Sorry, an error occurred while loading the content.
 

[BUG] “belowright copen” opens q f window below the rightmost one

Expand Messages
  • ZyX
    Consider the following script: vim -u NONE -c vnew | wincmd h | belowright copen . After running it the layout is the following +----+----+ ... +----+----+
    Message 1 of 2 , Oct 6, 2012
      Consider the following script:

      vim -u NONE -c 'vnew | wincmd h | belowright copen'
      . After running it the layout is the following

      +----+----+
      | 1 | 2 |
      | +----+
      | | qf |
      +----+----+
      while expected the same as when running

      vim -u NONE -c 'vnew | wincmd h | belowright new'
      :

      +----+----+
      | 1 | 2 |
      +----+ |
      | qf | |
      +----+----+
      .

      According to the doc
      > If it contains a command that splits a window, it will be opened right (vertical split) or below (horizontal split) the current window.
      , hence “belowright copen” shows invalid behavior, not “belowright new”.

      --
      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
    • Christian Brabandt
      Hi ZyX! ... This is intentional for :copen and :cwindow, see the comment at ex_copen below, but here is a patch: diff --git a/src/quickfix.c b/src/quickfix.c
      Message 2 of 2 , Oct 6, 2012
        Hi ZyX!

        On Sa, 06 Okt 2012, ZyX wrote:

        > Consider the following script:
        >
        > vim -u NONE -c 'vnew | wincmd h | belowright copen'
        > . After running it the layout is the following
        >
        > +----+----+
        > | 1 | 2 |
        > | +----+
        > | | qf |
        > +----+----+
        > while expected the same as when running
        >
        > vim -u NONE -c 'vnew | wincmd h | belowright new'
        > :
        >
        > +----+----+
        > | 1 | 2 |
        > +----+ |
        > | qf | |
        > +----+----+
        > .
        >
        > According to the doc
        > > If it contains a command that splits a window, it will be opened right (vertical split) or below (horizontal split) the current window.
        > , hence “belowright copen” shows invalid behavior, not “belowright new”.

        This is intentional for :copen and :cwindow, see the comment at ex_copen below, but here is a patch:

        diff --git a/src/quickfix.c b/src/quickfix.c
        --- a/src/quickfix.c
        +++ b/src/quickfix.c
        @@ -2340,7 +2340,8 @@
        /* The current window becomes the previous window afterwards. */
        win = curwin;

        - if (eap->cmdidx == CMD_copen || eap->cmdidx == CMD_cwindow)
        + if ((eap->cmdidx == CMD_copen || eap->cmdidx == CMD_cwindow) &&
        + cmdmod.split == 0)
        /* Create the new window at the very bottom. */
        win_goto(lastwin);
        if (win_split(height, WSP_BELOW | WSP_NEWLOC) == FAIL)


        regards,
        Christian
        --

        --
        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
      Your message has been successfully submitted and would be delivered to recipients shortly.