jed-users mailing list

[2017 Date Index] [2017 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Re: [jed-users] Re: getkey ()


On 22.08.17, Morten Bo Johansen wrote:
> On 2017-08-21 John E. Davis wrote:

> But there is: If I type alt-x _getkey and then type 'Æ' then
> the second octet of that two byte character is inserted into
> the buffer whereas it is not with alt-x getkey

I.e. getkey() is actually "get character" and leads to unexpected results if
a key on the keyboard is emits more than one character.

On jedmodes.sf.net (and in the jed-extra Debian package), there is the
strutils.sl module that provides:

get_keystring: library function

 SYNOPSIS
  Get the keystring of the next keypress event

 USAGE
   get_keystring()

 DESCRIPTION
  Wait for the next keypress and return all waiting input.
  This is the opposite of buffer_keystring.

 NOTES
  This may err for fast typing on slow terminals.


It works like David's example using the input_pending() function.


> I am trying to make a completion function that is something
> like this:

>    switch (getkey ())
>     { case 9: loop over words in completions array one by one }
>     { leave the chosen inserted completed word in the buffer and break }

It should work with

autoload("get_keystring", "strutils");

    switch (get_keystring())
     { case 9: loop over words in completions array one by one }
     { leave the chosen inserted completed word in the buffer and break }

(of course only, if you have installed strutils.sl).

Günter
_______________________________________________
For list information, visit <http://jedsoft.org/jed/mailinglists.html>.


[2017 date index] [2017 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]