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

2022-08-07 Thread Maxim Kim
And this is actually cursorhold, and I can filter it out with

if key == "\"
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 == "\"
return true
elseif key == "\"
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 == "\"
>> 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+unsubscr...@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.


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

2022-08-07 Thread 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 == "\"
> 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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_use/5a21ec1b-fc56-4b21-8f1e-40dee75d5f72n%40googlegroups.com.


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

2022-08-07 Thread 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 == "\"
    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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_use/0d2d33d5-c6be-64a0-1132-283820f30007%40gmail.com.


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

2022-08-07 Thread Maxim Kim



On 2022-08-07 17:53, Bram Moolenaar wrote:


Don't see it in the GIF.

in the message area at the end of gif <80>`


here probably is a third byte that you don't see.

Third byte is `

   0x80 0xfd is a
prefix for a special key.  There is a list in src/keymap.h, "enum
key_extra".


I have checked this enum, and have absolutely no idea how to figure out 
what is 0x80 0xfd `  and why it appears in the filter at all.


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

--
--
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_use/929f3df8-ac54-3d48-71b6-8e4a6b8c5e00%40gmail.com.


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

2022-08-07 Thread Salman Halim
Salman

On Sun, Aug 7, 2022, 10:53 Bram Moolenaar  wrote:

>
> 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>` 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 == "\"
> > 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>`:
> > [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".
>

It shows up on the command line at the bottom at the end of the GIF.

-- 
-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_use/CANuxnEdgVWJB8XW0LcmpryJMC5HA1FSN49FpXPsoZj7OW4AG0w%40mail.gmail.com.


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

2022-08-07 Thread Bram Moolenaar


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>` 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 == "\"
> 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>`:
> [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 -- b...@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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_use/20220807145320.BF5751C0EC3%40moolenaar.net.


popup window filter, what is <80>` ?

2022-08-07 Thread Maxim Kim
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>` 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 == "\"
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>`:
[image: viim-filter.gif]

-- 
-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_use/5d3c9840-b60e-4c07-9040-01d859a47fb0n%40googlegroups.com.