zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Edgar Merino <donvodka@gmail.com>
Cc: "zsh-workers@zsh.org" <zsh-workers@zsh.org>
Subject: Re: Keybindings lost in Xterm after top exits
Date: Wed, 06 Jun 2012 21:19:54 -0700	[thread overview]
Message-ID: <120606211954.ZM7057@torch.brasslantern.com> (raw)
In-Reply-To: <4FCFA55E.4090606@gmail.com>

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.


  reply	other threads:[~2012-06-07  4:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-30  5:40 Edgar Merino
2012-05-30 14:58 ` Bart Schaefer
2012-06-06 18:45   ` Edgar Merino
2012-06-07  4:19     ` Bart Schaefer [this message]
2012-06-07  4:53       ` Mikael Magnusson
2012-06-07  5:15         ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=120606211954.ZM7057@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=donvodka@gmail.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).