Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Id: Zsh Workers List <zsh-workers.zsh.org>
List-Post: <mailto:zsh-workers@zsh.org>
List-Help: <mailto:zsh-workers-help@zsh.org>
X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,
	T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=mime-version:in-reply-to:references:date:message-id:subject:from:to
         :cc;
        bh=N89Fkank2ByxC3F90Q1VMgZDvHx+CSkXTmDmRNTCZJE=;
        b=E2ibcHWvjBtmocT4B4bh8k3M5cBCUm+//olBWDnHuXQKPwEhGYEtqm/Re/+WHAa4g+
         CLFBFXO7/lT+quPrWkcgPNMyjKAp8SldRY0vJ6uOWWAPvQzX8ZcglRIJGc6G1uD76YpB
         vg+oDQ0PkC5QCZUWSCPILVo0v9xQdRGZF4mCSg5I1S1PNPH5IBchdov2v95KwRM7ctlO
         Esa3WaRhqPF0ft1Sb4Td+RYkLqk2FnCSgPQK05BcQovbhfUYvuE1NEVFLIkdmuWimwvD
         ZJS6+Evb3/mZAbJsaifB6Dh7jjZnwhS/nMtC1bINzZn0Xlx+rtqasgj8v24siYef8D0Y
         IOXA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:mime-version:in-reply-to:references:date
         :message-id:subject:from:to:cc;
        bh=N89Fkank2ByxC3F90Q1VMgZDvHx+CSkXTmDmRNTCZJE=;
        b=KWG+0fDOrE2KerfuezdeC5A0aj0E3UNcSUShbce+f2Uf0JjqXaED7EPOdDpJbTpOCP
         otb2r+xlaF562uKc+UYKgZ0yHliIKR0LPVMm1hXEBzt6UJxJMlcJkA/WIpZr0E+5xOME
         7ZNwjHzCbhZ7fqwy+73DP98iY6/B2plhrKzQ5W68jA9XHT84MrPWq5ZEUzMjRXbE6TG9
         P305O87TAjnBn2vDOzHfJ3NaKrvrxSRePRL9jjezyCYZftc8y1a+iRGJFEoltY+ZU/Fw
         xd0NaWDPurmIczEz+wBFlBErcQVke0ez6KT/MQ93+S+elnPxUREvbQprAzhiAkWIDZ7t
         9IOw==
X-Gm-Message-State: AD7BkJJz0n9boDQwdm+kzvJ0LcUTpx5IrbpfZuDP2nNcHUguAyg32lkzYn6O8VnBAhKRlpHPXbh3PZmvD8cQvA==
MIME-Version: 1.0
X-Received: by 10.140.28.135 with SMTP id 7mr4878569qgz.72.1460045244506; Thu,
 07 Apr 2016 09:07:24 -0700 (PDT)
In-Reply-To: <28148.1460042736@thecus.kiddle.eu>
References: <1459658514-24610-1-git-send-email-mikachu@gmail.com>
	<24571.1459953207@thecus.kiddle.eu>
	<CAHYJk3Q6aWvDL1nkcv0Ar9DSnwP2+i3Ze3DxdjDtVE3ttttymA@mail.gmail.com>
	<28148.1460042736@thecus.kiddle.eu>
Date: Thu, 7 Apr 2016 18:07:24 +0200
Message-ID: <CAHYJk3R9etXZy1G4UfTBYTMH1M0Xo_xP0Lzw1wr5Otx=C7wfwA@mail.gmail.com>
Subject: Re: PATCH: Add SHORT_KEYBIND_DISCARD option
From: Mikael Magnusson <mikachu@gmail.com>
To: Oliver Kiddle <okiddle@yahoo.co.uk>
Cc: zsh workers <zsh-workers@zsh.org>
Content-Type: text/plain; charset=UTF-8
X-Seq: zsh-workers 38252

On Thu, Apr 7, 2016 at 5:25 PM, Oliver Kiddle <okiddle@yahoo.co.uk> wrote:
> Mikael Magnusson wrote:
>> > Didn't we discuss this issue a few months ago - have you perhaps got a
>> > message reference?
>
> I managed to find this again: users/20358 is a good reference where Bart
> makes the point that this will have unpredictable effects for an unbound
> function key. Some of the thread is in -workers.

I'm not sure what exactly is unpredictable about it. Pressing F1,
you'll see [11~ instead of just the ~. (this is assuming you have some
other F-key bound, if you don't, you'll see 1~ because there's less
common prefix, so you're arguing for something that is already very
inconsistent). I could buy this argument if we ignored the whole key
including the final ~ too, but we don't. In emacs mode it gives you
more hints about what key you actually pressed, and in vi mode, ^[ is
already bound to vi-cmd-mode so the patch doesn't affect this case (it
already caseswaps 11 characters and leaves the user wondering wtf
happened).

> We could make discarding the keys conditional upon whether KEYTIMEOUT
> has elapsed since the prefix was received to account for that, however.
>
>> I think I asked if doing what this patch does was possible, but I want
>> it in general, not only because of bracketed-paste. If it were up to
>> me, this way would be the only way. It doesn't really make any sense
>> to me why we arbitrarily eat input just because it was a potential
>> common prefix that then turned out to not be part of any actual
>> keybinding. But since zsh people tend to like their things not
>> changing, I did the option.
>
> If get a prefixed key combination wrong, a beep seems cleaner than
> getting the latter part inserted.

People do things like bindkey -M viins jj vi-cmd-mode, but i'm sure
they still like to type words beginning with a j. (This works already
because j isn't undefined-key though).

You do have a point for things like ^X^D type stuff though, if I don't
have that bound maybe I don't want to accidentally close the shell.
(For weird people that don't use ignoreeof). :)

In my favor though, consider pressing alt-up from zsh -f in emacs
mode. Without the change, it will beep and insert [A, and with the
change it will beep (from the single escape), and then invoke the
up-line-or-history binding of the up key. That's better, arguably.

>> It just seems like a much more correct way of doing it to me.
>
> But is it also proving an irritation in actual practice? Are you often
> typing part of a long emacs-style binding and then being distracted by
> something in another window, perhaps?

I suppose it isn't.

> Would a separate timeout after which a prefix is discarded perhaps make sense?

I've sometimes harbored thoughts about allowing per-prefix timeouts even :).



Overall, I guess I'm a little bit less decided now than when I started
the thread.

-- 
Mikael Magnusson

