From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11926 invoked by alias); 23 May 2014 13:59:53 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 18847 Received: (qmail 22149 invoked from network); 23 May 2014 13:59:22 -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, SPF_HELO_PASS autolearn=ham version=3.3.2 From: Frank Terbeck To: Guido van Steen Cc: "zsh-users\@zsh.org" Subject: Re: Zsh changes on Ubuntu 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)") References: <87iop4zoih.fsf@ft.bewatermyfriend.org> <87sio67z71.fsf@ft.bewatermyfriend.org> <20140522165747.GK4356@sym.noone.org> <1400831962.56097.YahooMailNeo@web142702.mail.bf1.yahoo.com> <20140523104925.GC7931@sym.noone.org> <1400850035.39074.YahooMailNeo@web142704.mail.bf1.yahoo.com> User-Agent: Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3.50 (gnu/linux) Date: Fri, 23 May 2014 15:45:03 +0200 Message-ID: <87sio038yo.fsf@ft.bewatermyfriend.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Df-Sender: NDMwNDQ0 Guido van Steen wrote: > I looked into Thorsten's issue. I suspect it is caused by Fizsh being dep= endent > 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]=3D${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 =E2=80=98zkbd=E2=80=99, that doesn't set the mode, but instead let's the us= er press all sorts of special keys and records the escape sequences that produces. =E2=80=98zkbd=E2=80=99 also uses the $key[] map to store that information; = and we used the same keys in Debian's setup as =E2=80=98zkbd=E2=80=99 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? --=20 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