[vim/vim] popup filter gets the key at the hit-enter prompt (PR #21068)

h_east (Vim Github Repository) <[email protected]>
Newsgroups gmane.editors.vim.devel
Message-ID <vim/vim/pull/[email protected]>
```
Problem:  When a popup with a filter is displayed and a message causes the
          hit-enter prompt, the key goes to the popup filter instead of the
          prompt.  The closed popup then stays on the screen, since there is
          no redraw while the prompt is up.
Solution: Do not invoke popup filters while Vim is waiting for a key at a
          prompt of its own.  Adjust Test_popup_filter_win_execute_error(),
          which relied on the filter getting the key at the prompt.
```

fixes: #21052
related: #6999

At the hit-enter prompt `vgetc()` passes the key to `popup_do_filter()`, which
closes the popup and then calls `redraw_after_callback()`. That function does
nothing while `State` is `MODE_HITRETURN`, so the closed popup stays on the
screen until the prompt is dismissed by the second key.

The filter runs there because `MODE_HITRETURN` is `(0x2000 | MODE_NORMAL)`, so
the filter mode check matches even for `filtermode: 'n'`. The modes listed for
'filtermode' are editing modes, the hit-enter prompt is not one of them. That is
why this changes the filter side rather than the redraw side: redrawing while
the prompt is up would have to keep a message that was not confirmed yet, and
`msg_scrolled` is not 0 at that point.

`Test_popup_filter_win_execute_error()` sends CR at a hit-enter prompt on
purpose to make the filter run, so it needed changes: the key now dismisses the
prompt and the next key reaches the filter. The E994 step is gone, it came from
`popup_close()` finding the popup as `curwin` inside `win_execute()`, which no
longer happens in that sequence. That test comes from patch 8.2.1732 ("stuck
when win_execute() for a popup causes an error"), where the hit-enter prompt is
a side effect of the error message rather than the point of the test.

I think this is what the specification implies, but it changes which of the two
gets the key, so I would like to hear what you think.
You can view, comment on, or merge this pull request online at:

  https://github.com/vim/vim/pull/21068

-- Commit Summary --

  * popup filter gets the key at the hit-enter prompt

-- File Changes --

    M src/popupwin.c (7)
    A src/testdir/dumps/Test_popupwin_hit_enter_1.dump (15)
    A src/testdir/dumps/Test_popupwin_hit_enter_2.dump (15)
    M src/testdir/dumps/Test_popupwin_win_execute.dump (4)
    M src/testdir/test_popupwin.vim (36)

-- Patch Links --

https://github.com/vim/vim/pull/21068.patch
https://github.com/vim/vim/pull/21068.diff

-- 
Reply to this email directly or view it on GitHub:
https://github.com/vim/vim/pull/21068
You are receiving this because you are subscribed to this thread.

Message ID: <vim/vim/pull/[email protected]>

-- 
-- 
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].
To view this discussion visit https://groups.google.com/d/msgid/vim_dev/vim/vim/pull/21068%40github.com.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.