Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Keybindings lost in Xterm after top exits



On Jun 6,  1:45pm, Edgar Merino wrote:
}
} I would like to wrap top within a function, however I don't know how to 
} set the mode back to normal mode from a script, can you point me to any 
} source where I could investigate on how to this?

It should work to do this:

    zmodload zsh/terminfo
    top() {
      command top "$@"
      print -r "${terminfo[rmkx]}"
    }

If that does not work, try

    zmodload zsh/termcap
    top() {
      command top "$@"
      print -r "${termcap[ke]}"
    }

If you get something useful from "man terminfo" you should be able to
find a description of "rmkx" there.  (Searching that man page for the
string "keypad" is how I found it.)

As a more general solution it might also work to do

    zmodload zsh/terminfo
    zle-line-init() {
      print -r "${terminfo[rmkx]}"
    }
    zle -N zle-line-init

This will force the terminal into the right keypad mode whenever the line
editor starts up, so it'll work for any command.  However, you might find
some programs that misbehave across suspend with ctrl-Z and resume with fg
if the keypad mode changes while they are stopped.



Messages sorted by: Reverse Date, Date, Thread, Author