zsh-users
 help / color / mirror / code / Atom feed
From: Frank Terbeck <ft@bewatermyfriend.org>
To: Guido van Steen <gvsteen@yahoo.com>
Cc: "zsh-users\@zsh.org" <zsh-users@zsh.org>
Subject: Re: Zsh changes on Ubuntu
Date: Fri, 23 May 2014 15:45:03 +0200	[thread overview]
Message-ID: <87sio038yo.fsf@ft.bewatermyfriend.org> (raw)
In-Reply-To: <1400850035.39074.YahooMailNeo@web142704.mail.bf1.yahoo.com> (Guido van Steen's message of "Fri, 23 May 2014 06:00:35 -0700 (PDT)")

Guido van Steen wrote:
> I looked into Thorsten's issue. I suspect it is caused by Fizsh being dependent
> on raw directional codes. Newer versions of Ubuntu seem to work with a
> different set of raw directional codes than older versions. For example,

Yes, that's very likely.

> Ubuntu's raw code for "arrow-up" seems to have changed from "^[[A" to "^[0A".

That's probably ^[OA, but that's one possible difference between the
different possible terminal modes.

> This would explain why things work on Debian and Cygwin but not on Ubuntu.
>
> I agree with Frank's suggestion to revert to more portable code like:
>
>> bindkey "${key[Up]}"
>
> This does not work on my Debian system (Stable distribution), but it
> can be made to work like this:
>
>> typeset -A key
>> key[Up]=${terminfo[kcuu1]}

Yes, that's what Debian's global zshrc is setting up.

However, like I said before, using the values from $terminfo[] is only
valid reliably if the terminal is in keyboard-transmit mode (via smkx).

Finding out if there's a hook in place, that sets that mode while zle is
in place is hard to do reliably.

Then there are other ways in zsh to do setup for special keys, like
‘zkbd’, that doesn't set the mode, but instead let's the user press all
sorts of special keys and records the escape sequences that produces.

‘zkbd’ also uses the $key[] map to store that information; and we used
the same keys in Debian's setup as ‘zkbd’ does.

So... Here's how I'd probably tackle the problem:

  - You want to bind the $foo key.
  - Check if $key[$foo] exists and is non-empty.
  - If so, use that value as the sequence to bind with.
  - If not, fall back to some hard-coded sequence, if you like.

That way you support setups that use Debian's way and zkbd, while
having a fallback in place. I think that's better than having a bunch
of half-assed tries to detect what situation you're in.


Regards, Frank

PS. Yay for terminals, right?

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


  reply	other threads:[~2014-05-23 13:59 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-17  9:47 Thorsten Kampe
2014-05-17 10:29 ` Frank Terbeck
2014-05-19 10:57   ` Thorsten Kampe
2014-05-19 12:03     ` Frank Terbeck
2014-05-19 20:32       ` Thorsten Kampe
2014-05-19 21:15         ` Frank Terbeck
2014-05-22 16:57         ` Axel Beckert
2014-05-23  7:59           ` Guido van Steen
2014-05-23 10:49             ` Axel Beckert
2014-05-23 13:00               ` Guido van Steen
2014-05-23 13:45                 ` Frank Terbeck [this message]
2014-06-08  9:07                   ` Guido van Steen

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=87sio038yo.fsf@ft.bewatermyfriend.org \
    --to=ft@bewatermyfriend.org \
    --cc=gvsteen@yahoo.com \
    --cc=zsh-users@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).