[Pkg-zsh-devel] Bug#685511: zsh: /etc/zsh/zshrc brokes return on numpad

Frank Terbeck ft at bewatermyfriend.org
Tue Aug 21 14:23:36 UTC 2012


sergio wrote:
[...]
> Version: 5.0.0-2
>
> After upgrade to 5.0 numpad return (KP_Enter) key doesn't work anymore.

Yes. This is due to our reimplementation of keyboard handling within the
global zshrc file of the 5.0.0 packages.

What we did is enable application mode in the terminal, when the line
editor is active. Doing that is the right thing, because only then are
the entries in `$terminfo' correct.

Now as for KP_Enter: The corresponding terminfo capability for that key
is `kent', so the  following will work:

  % bindkey "${terminfo[kent]}" accept-line

However, not all terminals include `kent' in their terminfo entries.
Notably, the `screen' entry (used by terminal multiplexers such as GNU
screen and tmux) does not. So it's hard to bind that key properly.

You could fallback to the value from the `xterm' entry and hope every
other terminal follows xterm's lead... but what are the changes of that
happening? Anyway, here's a snippet that might work in many cases (at
least for xterm and urxvt with or without screen/tmux running inside):

[snip]
if (( ${+terminfo[kent]} )); then
    kent="${terminfo[kent]}"
else
    kent=$(TERM=xterm echoti kent 2>/dev/null)
    # If there is nothing in `$kent' yet, use "ESC O M", which is
    # what xterm and urxvt use.
    [[ -z "$kent" ]] && kent=$'\eOM'
fi
bindkey "$kent" accept-line
unset kent
[snap]

A little too hacky for debian's global zshrc, I think.

Regards, Frank



More information about the Pkg-zsh-devel mailing list