Sunday, August 7, 2022

Re: popup window filter, what is <80><fd>` ?

Maxim Kim wrote:

> Hi, currently there is no built-in way to have a prompt in a popup window
> so am trying to fake it with filtering.
>
> While in the early stages, I found out that the filter func constantly gets
> <80><fd>` value.
>
> What is this?
> How can I properly filter it out?
>
> With the following code:
>
> vim9script
>
> export def TestPopup(contents: string)
> var prompt = ""
> var main_id = popup_create(contents, {
> pos: 'center',
> mapping: 0,
> filter: (id, key) => {
> if key == "\<esc>"
> popup_close(id, -1)
> else
> prompt ..= key
> endif
> return true
> },
> callback: (id, result) => {
> echom prompt
> }
> })
> enddef
>
> TestPopup('hello')
>
> If you wait a 3-4 seconds and close popup with ESC, you will see <80><fd>`:
> [image: viim-filter.gif]

Don't see it in the GIF.

here probably is a third byte that you don't see. 0x80 0xfd is a
prefix for a special key. There is a list in src/keymap.h, "enum
key_extra".

--
hundred-and-one symptoms of being an internet addict:
269. You receive an e-mail from the wife of a deceased president, offering
to send you twenty million dollar, and you are not even surprised.

/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

--
--
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20220807145320.BF5751C0EC3%40moolenaar.net.

No comments: