Friday, July 2, 2010

Re: How to map release of keys? Needed to use vim as braille-readyeditor

On 02/07/10 11:22, Romeyke, Andreas wrote:
> Hello,
>
> Is it possible to map the keys "asdf hjkl" in insert-mode to be
> registered if the key is released and not pressed? Is it possible to
> collect all pressed keys until one of them will be released?

You can't. Many keyboard drivers will "forget" key-release events for
anything except Ctrl, Shift, Alt and the like, at a much lower level
than that at which Vim communicates with the OS.

But see :help 'timeout' and the ones near it, to see how Vim makes a
difference between ab (as the {lhs} of a mapping) and a <wait> b (where
a wait longer than 'timeoutlen' milliseconds will discard the "mapping"
interpretation if a alone maps to nothing).

>
> Example:
> user presses and holds key "a" and key "f", if key "a" is released, the
> mapped string will be "af ".
>
> Example:
> user presses "a", releases "a" and presses "f" and releases "f", the
> mapped string will be "a f"
>
> Is there an easy way to ignore order of key presses, so if the user
> presses and holds key "a" and key "f" the mapped string will be "af "
> and if user presses first "f" and then "a" the mapped sting will be "a f
> " too?

You can, if you bear in mind that Vim will see the keys in the order of
the keydown events. You could define... I don't know... Mappings for
abcdfe, abcedf, abcefd, abcfed, abcfde, abdcef, abdcfe, abdecf, abdefc,
abdfce, abdfec, abecdf, abecfd, abedcf, abedfc, abefcd, abefdc, abfcde,
abfced, abfdce, abfdec, abfecd, abfedc, etc., all to abcdef, and then
all 5-letter groups (to 6 different possible results), then 4- 3- and
2-letter groups would be possible but, I think, tedious.

Or you might define a function to get between 1 and 6 different letters
in the range [a-f] and reorder them. That would be more elegant, but the
problem would be how to call it.

Or else you could use a Braille font, with one six-dot glyph (well, six
dots, each of which may be present or absent) for each character... but
apparently I can't find it back. Maybe write (if it doesn't yet exist) a
keymap from Latin to the Braille patterns at Unicode codepoints U+2800
to U+28FF? See
http://www.unicode.org/charts/PDF/U2800.pdf
http://vim.wikia.com/wiki/How_to_make_a_keymap
and the help topics mentioned at the top of the latter.

Hm, I thought Braille patterns were made of six dots each (as at U+2800
to U+283F) but there they go on to eight dots...

To read the text, ISTR that keyboards "for blind people" exist, which
include a Braille display (one line of Braille, or maybe a few lines),
so that it can be read by touch, instead of a "visual" screen, by
someone who knows Braille...

>
> Still exists there a vim-plugin to generate computer-braille?

Maybe; I don't know.

>
> Bye Andreas


Best regards,
Tony.
--
Blore's Razor:
Given a choice between two theories, take the one which is
funnier.

--
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

No comments:

Post a Comment