Sunday, August 7, 2022

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

And this is actually cursorhold, and I can filter it out with

            if key == "\<cursorhold>"
                return true
...

Full snippet:

vim9script

def Test()
    var prompt: string = ''
    const wid: number = popup_create('', {
        minwidth: 20,
        maxheight: 1,
        mapping: false,
        filter: (winid: number, key: string): bool => {
            if key == "\<cursorhold>"
                return true
            elseif key == "\<esc>"
                popup_close(winid, -1)
            else
                prompt ..= key
                popup_settext(winid, prompt)
            else
                return false
            endif
            return true
        },
        callback: (_: number, result: number) => {
            if result == 0
                echomsg prompt
            endif
        }
    })
enddef

Test()


Still not sure why in gvim I get it into a filter func...

воскресенье, 7 августа 2022 г. в 18:55:46 UTC+3, Maxim Kim:
The issue is with windows gvim 9.0.133
I have tried the same in fedora36 vim 9.0.161 and it doesn't have this.

воскресенье, 7 августа 2022 г. в 18:49:03 UTC+3, Maxim Kim:

It looks like it happens on cursorhold event, not 100% sure though.

Indeed, if I change `set updatetime=1000` then I get this every second:


vim9script

def Test()
    var prompt: string = ''
    const wid: number = popup_create('', {
        minwidth: 20,
        maxheight: 1,
        mapping: false,
        filter: (winid: number, key: string): bool => {
            if key == "\<esc>"
                popup_close(winid, -1)
            else
                prompt ..= key
                popup_settext(winid, prompt)
            else
                return false
            endif
            return true
        },
        callback: (_: number, result: number) => {
            if result == 0
                echomsg prompt
            endif
        }
    })
enddef

Test()


--
--
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/be7754bb-c77b-486e-9767-6f06d73afd2en%40googlegroups.com.

No comments:

Post a Comment