I have ancient serial terminals connected to a NetBSD 9.0. So far all works perfectly, except:

When I start an application software, this software switches the terminal's keypad to application mode, so the keypad cannot be used inside the application. After leaving this special application, the keypad mode is reset.

I guess the /usr/share/misc/terminfo database holds the information on how to switch the keypad's mode. But what to look for? Btw, it doesn't make a difference what TERM environment is set. Tried it with "vt510" (the physical terminal is a DEC VT 510), as well as with "vt220" and "vt100".

A hint on how to alter the termcap database was appreciated ☺ TIA!

  • rvp replied to this.
  • Jay likes this.
  • Blackavar See section 2.8 Keyboard Menu. You could also type these (using another console or xterm):

    env TERM=vt510 tput smkx > /dev/vt510-ttyname    # DECKPAM—Keypad Application Mode
    env TERM=vt510 tput rmkx > /dev/vt510-ttyname    # DECKPNM—Keypad Numeric Mode
    
    # OR
    
    printf '\033=' > /dev/vt510-ttyname    # DECKPAM—Keypad Application Mode
    printf '\033>' > /dev/vt510-ttyname    # DECKPNM—Keypad Numeric Mode

    FYI: DECKPAM, DECKPNM, DECNKM

    Blackavar See section 2.8 Keyboard Menu. You could also type these (using another console or xterm):

    env TERM=vt510 tput smkx > /dev/vt510-ttyname    # DECKPAM—Keypad Application Mode
    env TERM=vt510 tput rmkx > /dev/vt510-ttyname    # DECKPNM—Keypad Numeric Mode
    
    # OR
    
    printf '\033=' > /dev/vt510-ttyname    # DECKPAM—Keypad Application Mode
    printf '\033>' > /dev/vt510-ttyname    # DECKPNM—Keypad Numeric Mode

    FYI: DECKPAM, DECKPNM, DECNKM

      You can alter the default termcap definitions for your TERM, by specifying editline(7)'s bindings inside a ~/.editrc file (or whatever pointed by $EDITRC). You can checkout your TERM's definition via infocmp, and compare capabilities codes by looking up terminfo(5). My ~/.editrc for screen-256color.

      bind -v                                         # use vi mode
      bind '^D' vi-list-or-eof
      bind '^H' vi-delete-prev-char
      bind '^J' ed-newline
      bind '^L' ed-clear-screen
      bind '^R' em-inc-search-prev
      bind '^U' vi-kill-line-prev
      bind '^W' ed-delete-prev-word
      bind '^\' vi-command-mode
      bind '\E[3~' ed-delete-prev-word                # delete
      bind '\EOD' vi-prev-word                        # kp_left
      bind '\EOC' vi-next-word                        # kp_right
      bind '\E[1;5D' vi-prev-word                     # ctrl_left
      bind '\E[1;5C' vi-next-word                     # ctrl_right
      bind '\E[C' ed-next-char                        # right 
      bind '\E[D' ed-prev-char                        # left
      bind '\E[4~' ed-end-of-file                     # end
      bind '\E[5~' ed-search-next-history             # pg_up
      bind '\E[6~' ed-search-prev-history             # pg_down
      

      rvp

      smkx and rmkx were the essential hints for me, thanks. I altered the vt510 terminfo entry by removing those both items. Now it works as expected.

      Thanks a lot!

      • Jay likes this.