keypad mode

Oskar Liljeblad oskar at osk.mine.nu
Thu Jan 3 08:58:48 UTC 2002


In key.c the following hack is used to enable/disable keypad mode
(reporting of keypad keys with special terminal sequences):

  /* xterm and linux console only: set keypad to numeric or application
     mode. Only in application keypad mode it's possible to distinguish
     the '+' key and the '+' on the keypad ('*' and '-' ditto)*/
  void
  numeric_keypad_mode (void)
  {
      if (console_flag || xterm_flag) {
          fprintf (stdout, "\033>");
          fflush (stdout);
      }
  }

  void
  application_keypad_mode (void)
  {
      if (console_flag || xterm_flag) {
          fprintf (stdout, "\033=");
          fflush (stdout);
      }
  }

The correct way would be to use the terminfo capabilities "rmkx"
and "smkx" instead of hardcoded strings (and console_flag/
xterm_flag). But there is one problem:

How do you get this capability? If ncurses was available the
correct function would be "tigetstr". But it seems more
complicated with slang. Any ideas?

Oskar Liljeblad (oskar at osk.mine.nu)




More information about the mc-devel mailing list