nano-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nano-devel] warning the user that some keys cannot be rebound


From: Benno Schulenberg
Subject: Re: [Nano-devel] warning the user that some keys cannot be rebound
Date: Sun, 11 Sep 2016 12:10:17 +0200


On Sun, Sep 11, 2016, at 11:32, Rishabh Dave wrote:
> On Thu, Sep 8, 2016 at 12:24 AM, Benno Schulenberg
> <address@hidden> wrote:
> >
> > On Wed, Sep 7, 2016, at 11:57, Rishabh Dave wrote:
> >> On Wed, Sep 7, 2016 at 3:02 PM, Rishabh Dave <address@hidden> wrote:
> >> > Attached patch checks if there are more than 2 characters (in key to
> >> > be rebound i.e. variable keycopy in code) and if so rejects it with
> >> > the message (same as earlier).
> >
> > And what about M-A, or F12, for example?  They are valid, but more
> > than two characters.
> 
> Patch implements: for control key sequences, disallow combination with
> length more than 2 characters and for meta key sequences, disallow
> combination with length more than 3 characters.

You could just disallow /any/ keystring longer than three characters
(as long as they are not ^Space or M-Space).

-    } else if (keycopy[0] == '^' && (keycopy[1] < 64 || keycopy[1] > 127)) {
+    } else if ((keycopy[0] == '^' && (keycopy[1] < 64 || keycopy[1] > 127))
+               || (keycopy[0] == '^' && strcmp(keycopy, "^Space") != 0 &&

The leading || is out of style.  And doing again a "keycopy[0] == '^'" when
it has just been done is a bit wasteful -- you can just || or extra conidtion
into the second one.  See attached patch.

> Would it be better if we also disallow meta sequences where '-' is
> missing

Yes.   But don't take it any further than that.

> and function key with more than 2 digits after 'F'?

Yes, but that's already covered by attached version.

Benno

-- 
http://www.fastmail.com - Choose from over 50 domains or use your own

Attachment: check-that-keystrings-are-within-bounds.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]