nano-devel
[Top][All Lists]
Advanced

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

Re: [Nano-devel] [PATCH] add rebinding for Ctrl+Arrow-keys combinations


From: Rishabh Dave
Subject: Re: [Nano-devel] [PATCH] add rebinding for Ctrl+Arrow-keys combinations
Date: Wed, 3 Aug 2016 19:42:18 +0530

On Wed, Aug 3, 2016 at 1:36 PM, Benno Schulenberg
<address@hidden> wrote:
> You might have wanted to discuss the bug first.  Maybe the fix is not
> to make the arrow keys rebindable but to properly warn that they are
> unrebindable (instead of making it seem as if they were rebound but
> not actually having done anything, as it is now).

Unrebindable... how? This patch does add the ability of reassigning
the functions to ^Arrow keys. (which is rebinding, if I am correct)

> But okay, let's assume that we want to make them rebindable -- maybe
> someone wants to assign Undo and Redo to ^Left and ^Right, and Find-
> Previous and Find-Next to ^Up and ^Down.

Tried above combinations in ~/.nanorc, it works.

>> Since I was dubious regarding my method, I have kept the patch
>> incomplete (checking for and updating code to new commits,
>
> Ah, but /that/ you should do.  A patch against old code is not useful.

Ohkay. Updated patch is attached.

>
> About the patch itself:
>
>      } else /* RAWINPUT */
>         s->seq = (int) s->keystr[0]
>
> Those lines don't exist any more.  Patch fails to apply.
>
> +    if (!strcasecmp(s->keystr, "^Left"))
> +       s->seq = 544;
>
> ??  544?  Where did you get that value from?  And how do you know
> it will have that value everywhere?  There are defines for those
> things; use them.

For the value, I did fprintf() to look at input value when we do
^Arrow-keys. I know that that mostly it won't work across various
platforms but I aim was to see for myself if the keys are indeed
rebindable. About defines, assigning CONTROL_LEFT (or respective for
other arrow keys) doesn't help. Then, there was "controlleft =
key_defined(keyvalue);" statement(s) in src/nano.c, so I assigned
controlleft; that didn't work too. They both give "Unbound key"
message. So, for now I haven't figured out why it didn't work and how
it will work.

>
> +       /* Find same function in sclist and assign same toggle value
> +        * to new shortcut. */
> +       newsc->toggle = first_sc_for(currmenu, newsc->scfunc)->toggle;
>
> What are those lines doing there?  Are you saying that the rebinding
> of toggles doesn't work right now?

Before adding this code, valgrind reported that jump depends on
uninitialized value at the body of the loop below in src/help.c.
Adding this made it disappear.

However, in this patch I have moved this block little up, as we were
accessing newsc->toggle just above. Also, first_sc_for() can return
NULL, so code covers that case this time.

 /* First see how many toggles there are. */
        for (s = sclist; s != NULL; s = s->next)
            maximum = (s->toggle && s->ordinal > maximum) ? s->ordinal
: maximum;



Can I make a request? I would like to try searchable help
feature-request (http://savannah.gnu.org/bugs/?28994). Can it be
kind-of reserved? It is this bug that I wanted to try since I began
visiting nano's GNU page. (Mostly, because it was the only bug then I
was able to understand right from the title.) I will really like it if
I could work on searchable help, /even though/ I don't know if I can
even tackle a piece of it.

Attachment: rebind-ctrl-arrow-keys.patch
Description: Text Data


reply via email to

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