From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3194 invoked by alias); 7 Jun 2012 04:20:19 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 30500 Received: (qmail 20286 invoked from network); 7 Jun 2012 04:20:08 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <120606211954.ZM7057@torch.brasslantern.com> Date: Wed, 06 Jun 2012 21:19:54 -0700 In-reply-to: <4FCFA55E.4090606@gmail.com> Comments: In reply to Edgar Merino "Re: Keybindings lost in Xterm after top exits" (Jun 6, 1:45pm) References: <4FC5B2CB.6090701@gmail.com> <120530075824.ZM6547@torch.brasslantern.com> <4FCFA55E.4090606@gmail.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: Edgar Merino Subject: Re: Keybindings lost in Xterm after top exits Cc: "zsh-workers@zsh.org" MIME-version: 1.0 Content-type: text/plain; charset=us-ascii 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.