On 15/05/14 13:15, mattn wrote:
Thanks. Did you check that it still works to obtain a special key?
For example, the cursor-up key <Up>.
It seems that getchar(0)/getchar(1) doesn't work with cursor-up before this
change.
I get the following with gvim 7.4.295 (GTK2/GNOME2), testing all three
arguments for getchar():
no argument, wait then return the key
:echo getchar()
hit <Up> key
<80>ku
The same, but hit <Esc> instead
27
argument 0, return the key if available, else zero
:let c = 0|while !c|let c = getchar(0)|endwhile|echo c
hit <Up>
nothing happens
hit other cursor-moving keys
still nothing happens
hit <Esc>
27
argument 1, don't consume the key, return 0 if no key available
:while !getchar(1)|endwhile|let c = getchar(1)|echo c|let c =
getchar(0)|echo c
hit <Up>
128
<80>ku
The same, but hit <Esc> instead
27
27
slight variant on the latter test
:let c = 0|while !c|let c = getchar(1)|endwhile|echo c|let c =
getchar(0)|echo c
hit <Up>
128
<80>ku
The same but hit <Esc>instead
no visible echo, the command-line is cleared and the cursor returns to
the main window
refine the variant
:let c = 0|while !c|let c = getchar(1)|endwhile|echomsg c|let c =
getchar(0)|echomsg c
hit <Esc>
27
27
tl;dr: Works for me in all but one case (multibyte keystroke with
getchar(0) not preceded by getchar(1) but looped-on instead)
Best regards,
Tony.
--
hundred-and-one symptoms of being an internet addict:
115. You are late picking up your kid from school and try to explain
to the teacher you were stuck in Web traffic.
--
--
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].
For more options, visit https://groups.google.com/d/optout.