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

[patch] Problem with completion menu and scrolling

Expand Messages
  • Lech Lorens
    Executing the following script (e.g. by saving it into a file called do.vim and executing vim -u NONE -S do.vim ) while in src directory containing Vim
    Message 1 of 4 , Mar 2, 2010
    • 0 Attachment
      Executing the following script (e.g. by saving it into a file called
      do.vim and executing "vim -u NONE -S do.vim") while in src directory
      containing Vim sources should give an incorrectly placed pop-up menu.

      #v+
      set nocompatible
      syntax on
      filetype plugin indent on
      e ex_docmd.c
      set lines=76
      set scrolloff=0
      set nosplitbelow
      1647
      normal zt
      1687
      call feedkeys("o\<CR>if (ea.\<C-x>\<C-o>\<C-e>\<C-x>\<C-o>", 'n')
      #v-

      If you scroll through the entries by pressing <C-n> or <C-p> you will
      notice that the part of the menu above the line containing the cursor is
      only an image of a previously drawn menu which should have in fact been
      cleared.

      The attached patch fixes the problem.

      The source of the problem:

      The function ins_compl_show_pum() is called twice:
      - once by ins_compl_next() which is called by ins_complete(),
      - once by ins_complete() itself.

      ins_compl_show_pum() calls pum_display() which uses the value of
      curwin->w_wrow to calculate the position of the pop-up menu.
      curwin->w_wrow is different in the two calls to ins_compl_show_pum().

      NOTE:
      - being able to reproduce the problem depends on the size of the screen
      (hence "set lines=76"),
      - it is not possible to make the check for w_wrow in
      ins_compl_upd_pum(), as it would not work for gvim (setcursor()
      is called in ins_compl_next()).

      --
      Cheers,
      Lech

      --
      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
    • Dominique Pellé
      ... Hi I don t see anything wrong when I execute those steps with Vim in a terminal (gnome-terminal). However, by default, there is no pum and I see... -- Omni
      Message 2 of 4 , Mar 2, 2010
      • 0 Attachment
        Lech Lorens wrote:

        > Executing the following script (e.g. by saving it into a file called
        > do.vim and executing "vim -u NONE -S do.vim") while in src directory
        > containing Vim sources should give an incorrectly placed pop-up menu.
        >
        > #v+
        > set nocompatible
        > syntax on
        > filetype plugin indent on
        > e ex_docmd.c
        > set lines=76
        > set scrolloff=0
        > set nosplitbelow
        > 1647
        > normal zt
        > 1687
        > call feedkeys("o\<CR>if (ea.\<C-x>\<C-o>\<C-e>\<C-x>\<C-o>", 'n')
        > #v-
        >
        > If you scroll through the entries by pressing <C-n> or <C-p> you will
        > notice that the part of the menu above the line containing the cursor is
        > only an image of a previously drawn menu which should have in fact been
        > cleared.
        >
        > The attached patch fixes the problem.
        >
        > The source of the problem:
        >
        > The function ins_compl_show_pum() is called twice:
        > - once by ins_compl_next() which is called by ins_complete(),
        > - once by ins_complete() itself.
        >
        > ins_compl_show_pum() calls pum_display() which uses the value of
        > curwin->w_wrow to calculate the position of the pop-up menu.
        > curwin->w_wrow is different in the two calls to ins_compl_show_pum().
        >
        > NOTE:
        > - being able to reproduce the problem depends on the size of the screen
        >  (hence "set lines=76"),
        > - it is not possible to make the check for w_wrow in
        >  ins_compl_upd_pum(), as it would not work for gvim (setcursor()
        >  is called in ins_compl_next()).

        Hi

        I don't see anything wrong when I execute those steps
        with Vim in a terminal (gnome-terminal).

        However, by default, there is no pum and I see...

        -- Omni completion (^O^N^P) Pattern not found

        To see the pum, I first need to build a "tags" file with
        for example:

        $ cd vim/src
        $ ctags -R --c++-kinds=+p --fields=+iaSn --extra=+q .
        $ vim -u NONE -S do.vim

        The pum then shows up fine and pressing <C-n> or <C-p>
        also updates the pum correctly here (using regular
        Vim-7.2.385 without your patch).

        Can you perhaps give a screenshot of what you saw?

        Having said that, when I try to do it in gvim (GTK2) with...

        $ vim -f -g -u NONE -S do.vim

        .., then I do not see the pum anymore?! In fact, I do
        not see the statusline either in gvim. It happens because
        my screen is too small to display 76 lines. Commenting
        out the line "set lines=76" in "do.vim" or setting a line number
        small enough to be fully displayed on screen (such as
        "set lines=40") makes it work in gvim too (no pum display
        bug). I believe that not seeing the statusline when giving
        a high value for "set lines=..." is another bug. Does
        anybody else see that too?

        Can you also reproduce the bug with a small value of lines?
        (such as "set lines=40")?

        Cheers
        -- Dominique

        --
        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
      • Lech Lorens
        ... The smallest value of lines for which I managed to reproduce the bad behaviour is 57, but then the wrong menu image is only 1-line long and is visible
        Message 3 of 4 , Mar 3, 2010
        • 0 Attachment
          2010/3/3 Dominique Pellé <dominique.pelle@...>:
          > Hi
          >
          > I don't see anything wrong when I execute those steps
          > with Vim in a terminal (gnome-terminal).
          >
          > However, by default, there is no pum and I see...
          >
          >  -- Omni completion (^O^N^P) Pattern not found
          >
          > To see the pum, I first need to build a "tags" file with
          > for example:
          >
          >  $ cd vim/src
          >  $ ctags -R --c++-kinds=+p --fields=+iaSn --extra=+q .
          >  $ vim -u NONE -S do.vim
          >
          > The pum then shows up fine and pressing <C-n> or <C-p>
          > also updates the pum correctly here (using regular
          > Vim-7.2.385 without your patch).
          >
          > Can you perhaps give a screenshot of what you saw?
          >
          > Having said that, when I try to do it in gvim (GTK2) with...
          >
          >  $ vim -f -g -u NONE -S do.vim
          >
          > .., then I do not see the pum anymore?!  In fact, I do
          > not see the statusline either in gvim.  It happens because
          > my screen is too small to display 76 lines.  Commenting
          > out the line "set lines=76" in "do.vim" or setting a line number
          > small enough to be fully displayed on screen (such as
          > "set lines=40") makes it work in gvim too (no pum display
          > bug).  I believe that not seeing the statusline when giving
          > a high value for  "set lines=..." is another bug.  Does
          > anybody else see that too?
          >
          > Can you also reproduce the bug with a small value of lines?
          > (such as "set lines=40")?
          >
          > Cheers
          > -- Dominique
          >

          The smallest value of lines for which I managed to reproduce the bad
          behaviour is 57, but then the wrong menu image is only 1-line long and is
          visible below the cursor line. The problem seems to be related to the number
          of entries in the menu and the size of the window.

          I made screenshots with lines=76:
          - after executing the script from my original email:
          http://pl.tinypic.com/view.php?pic=2q99or7&s=6
          - after pressing <C-n>
          http://pl.tinypic.com/view.php?pic=2ms11sg&s=6

          Regarding your question about disappearing status line when the value of
          'lines' is too large - yes, I can see the problem.

          --
          Best regards,
          Lech Lorens

          --
          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
        • Bram Moolenaar
          ... Thanks. I ll look at the details later. -- Why doesn t Tarzan have a beard? /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net ///
          Message 4 of 4 , Mar 3, 2010
          • 0 Attachment
            Lech Lorens wrote:

            > Executing the following script (e.g. by saving it into a file called
            > do.vim and executing "vim -u NONE -S do.vim") while in src directory
            > containing Vim sources should give an incorrectly placed pop-up menu.
            >
            > #v+
            > set nocompatible
            > syntax on
            > filetype plugin indent on
            > e ex_docmd.c
            > set lines=76
            > set scrolloff=0
            > set nosplitbelow
            > 1647
            > normal zt
            > 1687
            > call feedkeys("o\<CR>if (ea.\<C-x>\<C-o>\<C-e>\<C-x>\<C-o>", 'n')
            > #v-
            >
            > If you scroll through the entries by pressing <C-n> or <C-p> you will
            > notice that the part of the menu above the line containing the cursor is
            > only an image of a previously drawn menu which should have in fact been
            > cleared.
            >
            > The attached patch fixes the problem.
            >
            > The source of the problem:
            >
            > The function ins_compl_show_pum() is called twice:
            > - once by ins_compl_next() which is called by ins_complete(),
            > - once by ins_complete() itself.
            >
            > ins_compl_show_pum() calls pum_display() which uses the value of
            > curwin->w_wrow to calculate the position of the pop-up menu.
            > curwin->w_wrow is different in the two calls to ins_compl_show_pum().
            >
            > NOTE:
            > - being able to reproduce the problem depends on the size of the screen
            > (hence "set lines=76"),
            > - it is not possible to make the check for w_wrow in
            > ins_compl_upd_pum(), as it would not work for gvim (setcursor()
            > is called in ins_compl_next()).

            Thanks. I'll look at the details later.

            --
            Why doesn't Tarzan have a beard?

            /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
            /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
            \\\ download, build and distribute -- http://www.A-A-P.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
          Your message has been successfully submitted and would be delivered to recipients shortly.