zsh-users
 help / color / mirror / code / Atom feed
* $terminfo for up and down arow
@ 2014-01-08  8:33 Ivan Brkanac
  2014-01-08  8:55 ` Frank Terbeck
  0 siblings, 1 reply; 5+ messages in thread
From: Ivan Brkanac @ 2014-01-08  8:33 UTC (permalink / raw)
  To: zsh-users

hello,
as from zsh 5.0.3 and till 5.0.5 there is some change in up and down
arrow as reported by "$terminfo[kcuu1]" and "$terminfo[kcud1]" it
reports ^[OB and ^[OA on os x 10.9.1 and zsh from homebrew corect
sequence is '^[[B' and '^[[A' there is corresponding bug report
https://github.com/sorin-ionescu/prezto/issues/516 with some more
details.

Thanks.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: $terminfo for up and down arow
  2014-01-08  8:33 $terminfo for up and down arow Ivan Brkanac
@ 2014-01-08  8:55 ` Frank Terbeck
  2014-01-08  9:38   ` Frank Terbeck
  0 siblings, 1 reply; 5+ messages in thread
From: Frank Terbeck @ 2014-01-08  8:55 UTC (permalink / raw)
  To: Ivan Brkanac; +Cc: zsh-users

Ivan Brkanac wrote:
> as from zsh 5.0.3 and till 5.0.5 there is some change in up and down
> arrow as reported by "$terminfo[kcuu1]" and "$terminfo[kcud1]" it
> reports ^[OB and ^[OA on os x 10.9.1 and zsh from homebrew corect
> sequence is '^[[B' and '^[[A'.

The correct values largely depend on the value of $TERM. For example,
with $TERM := screen, the correct value is "^[OA".

What might be confusing you, is the fact that the values from $terminfo
are _only_ valid in "keyboard-transmit-mode". That's the mode you enter,
by issuing "smkx" and you leave by "rmkx" (see terminfo(5)).

Zsh's line editor (zle), does not do this by default, but it can by made
to do that, when it is active. One caveat to note is, that not all
terminals _have_ an explicit "smkx" mode (they just default to being in
"keyboard-transmit-mode" all the time), so you need to check for the
ability of the terminal before trying to use it:

zle-line-init () {
    (( ${+terminfo[smkx]} )) && echoti smkx
}
zle-line-finish () {
    (( ${+terminfo[rmkx]} )) && echoti rmkx
}

Regards, Frank


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: $terminfo for up and down arow
  2014-01-08  8:55 ` Frank Terbeck
@ 2014-01-08  9:38   ` Frank Terbeck
  2014-01-10 12:38     ` Ivan Brkanac
  0 siblings, 1 reply; 5+ messages in thread
From: Frank Terbeck @ 2014-01-08  9:38 UTC (permalink / raw)
  To: Ivan Brkanac; +Cc: zsh-users

Frank Terbeck wrote:
[...]
> zle-line-init () {
>     (( ${+terminfo[smkx]} )) && echoti smkx
> }
> zle-line-finish () {
>     (( ${+terminfo[rmkx]} )) && echoti rmkx
> }

For the record, you also need to make these known as widgets for zle to
pick them up, so:

    zle -N zle-line-init
    zle -N zle-line-finish

Regards, Frank

-- 
In protocol design, perfection has been reached not when there is
nothing left to add, but when there is nothing left to take away.
                                                  -- RFC 1925


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: $terminfo for up and down arow
  2014-01-08  9:38   ` Frank Terbeck
@ 2014-01-10 12:38     ` Ivan Brkanac
  2014-01-10 12:48       ` Peter Stephenson
  0 siblings, 1 reply; 5+ messages in thread
From: Ivan Brkanac @ 2014-01-10 12:38 UTC (permalink / raw)
  Cc: zsh-users

Quote from ticket:
"""
I have found the problem. It's an upstream bug, as I have suspected,
but I have also found the way to get around it.

I am defining three functions with the same function body to not
repeat myself. Even though I have verified that the functions have
been defined properly, they exist, my zle-line-init and
zle-line-finish are not being called. Something must have changed in
recent Zsh versions that affects this.

When I split that code into three distinct function definitions, it works.
"""

version 5.0.5 is also affected

On Wed, Jan 8, 2014 at 10:38 AM, Frank Terbeck <ft@bewatermyfriend.org> wrote:
> Frank Terbeck wrote:
> [...]
>> zle-line-init () {
>>     (( ${+terminfo[smkx]} )) && echoti smkx
>> }
>> zle-line-finish () {
>>     (( ${+terminfo[rmkx]} )) && echoti rmkx
>> }
>
> For the record, you also need to make these known as widgets for zle to
> pick them up, so:
>
>     zle -N zle-line-init
>     zle -N zle-line-finish
>
> Regards, Frank
>
> --
> In protocol design, perfection has been reached not when there is
> nothing left to add, but when there is nothing left to take away.
>                                                   -- RFC 1925


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: $terminfo for up and down arow
  2014-01-10 12:38     ` Ivan Brkanac
@ 2014-01-10 12:48       ` Peter Stephenson
  0 siblings, 0 replies; 5+ messages in thread
From: Peter Stephenson @ 2014-01-10 12:48 UTC (permalink / raw)
  To: Ivan Brkanac, zsh-users

On Fri, 10 Jan 2014 13:38:40 +0100
Ivan Brkanac <ibrkanac@gmail.com> wrote:
> I have found the problem. It's an upstream bug, as I have suspected,
> but I have also found the way to get around it.
> 
> I am defining three functions with the same function body to not
> repeat myself. Even though I have verified that the functions have
> been defined properly, they exist, my zle-line-init and
> zle-line-finish are not being called. Something must have changed in
> recent Zsh versions that affects this.
> 
> When I split that code into three distinct function definitions, it works.

Please could you supply the code you're using to set this up?  It's not
clear whether you're using


zle-line-init zle-line-finish() { ... }
zle -N zle-line-init
zle -N zle-line-finish


or


zle-line-base-function() { ... }
zle -N zle-line-init zle-line-base-function
zle -N zle-line-end zle-line-base-function


both of which would have the effect you say.

Thanks
pws


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-01-10 12:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-08  8:33 $terminfo for up and down arow Ivan Brkanac
2014-01-08  8:55 ` Frank Terbeck
2014-01-08  9:38   ` Frank Terbeck
2014-01-10 12:38     ` Ivan Brkanac
2014-01-10 12:48       ` Peter Stephenson

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).