Node:Key bindings, Next:, Previous:Application definition file syntax, Up:Top



Key bindings

In kort curses handles key bindings that are used in parsing user input at runtime. This brings some problems and solves others. One curses-related problems is that awfully lot of terminals seem to have broken termcap entry what it comes to function keys. As kort deals with function keys a little bit, using kort with broken-termcap-terminal may be cumbersome or impossible. In many cases using <ftp://ftp.funet.fi/pub/gnu/prep/screen/> helps. If kort is used in xterm it is possible to control function key behaviour from xterm resources1 and have different kind of behaviour2. Curses defines some keys that depend on your keyboard and termcap entry, like KEY_DOWN that is found somewhere in depths of #included <ncurses.h> that in AT keyboard is usually the key with down arrow printed on it but then, it may vary. In the following table the ^X means ctrl and X and something like KEY_DOWN is the key or key sequence that curses implements and that you should find from your curses documentation. Important concept in here is tab order that happens to be the same order where fields are given in application definition file. When user presses "next key" equivalent, the next field in said order receives the input focus.

Key Happening
KEY_DOWN or KEY_NEXT or ^N Next field in tabulating order is selected for input focus.
KEY_UP or KEY_PREVIOUS or ^P Previous field in tab order is given input focus. If First field defined in application definition file, after this command focus is in last field.
KEY_HOME Focus is moved to first field defined in application definition file.
KEY_END or KEY_LL Focus is moved to last field defined in application definition file.
^L Focus is moved to field left of the field currently focused. Selection of what is left is made by curses form library.
^R Focus is moved to field right of the field currently focused.
^U Focus is moved to field up of the field currently focused.
^D Focus is moved to field down of the field currently focused.
^W Cursor is moved within a field to next word. This functionality is implemented in the internals of curses form library; whitespace seems to mark word boundary, refer to curses documentation about next word concept.
^B Cursor is moved within a field to previous word.
^S Cursor is moved to beginning of current field.
^E Cursor is moved to end of current field.
KEY_LEFT Cursor is moved one character position left within the current field.
KEY_RIGHT Cursor is moved one character position right within the current field.
^M Line break within field is requested. In current incarnation kort does not support multiline items so functionality here is pretty void.
^I Inserts one character position to current field to current cursor position.
^O Insert line break to current field. See explanation at ^M.
^V or KEY_DC Deletes one character from current field from position that is at cursor position. Characters in current field that are right of cursor are moved left one position. Usually KEY_DC is the key labeled Delete.
^H or KEY_BACKSPACE Deletes character that is before cursor. Just like backspace does.
^Y Kills the line where cursor is located. From beginning of line, not from cursor position.
^G Deletes word from cursor.
^C Clears to end of line from cursor position.
^K Clears to end of field from cursor position. As kort has only single row fields this is essentially same as ^C.
KEY_IC Toggles insert/overwrite -mode. Usually the key labeled Insert. There is no visible indication of input mode, not before user tries out.
KEY_EIC Enters insert mode from overwrite mode. In insert mode does nothing.
These key bindings are not easily customizable, if unhappy, the source code file is visualization.c and function there is form_virtualize that should be pretty straigh-forward and understandable in case you want to change anything. Kudos for this input-holabaloo goes to the ncurses team where input code and form code is for most part stolen.


Footnotes

  1. man xterm & man xrdb

  2. like that in RH6.0 xterm did not work with F1-F4 but the same binary with name nxterm and different resources was ok