bugGNU nano - Bugs: bug #54659, [Request] make modified Alt+letter...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #54659: [Request] make modified Alt+letter combinations bindable

Submitter:  Peter Passchier <pepa65>
Submitted:  Thu 13 Sep 2018 07:29:32 PM UTC
   
 
Severity:  1 - Wish Status:  Fixed
Assigned to:  bens Open/Closed:  Closed

Jump to the original submission

Sun 09 Feb 2020 10:21:07 AM UTC, comment #23: 

The ability to rebind Shift+Meta+letter has been released in version 4.8.

Benno Schulenberg <bens>
Group administrator
Thu 06 Feb 2020 06:25:03 PM UTC, comment #22: 

(It's not in the terminal emulator itself: it happens in an exterm as well.  So it's a bug in their input system.  Or I misconfigured something, maybe.  Some day I will reinstall that system and see.)

Benno Schulenberg <bens>
Group administrator
Thu 06 Feb 2020 03:40:52 PM UTC, comment #21: 

Isn't that just a bug in that terminal emulator then? Interesting though..! But not very practical...

Peter Passchier <pepa65>
Thu 06 Feb 2020 03:20:33 PM UTC, comment #20: 

(Strangely, this does not work on the terminal emulator of Elementary, the distro, version 5.1, Hera.  When you first press Shift, then Alt, and then for example b, the result is simply B.  When you first press Alt, then Shift, and then b, the result is ESC b.  Only the first of Shift and Alt is registered.  :|  It works fine on an old version of Elementary, Luna.)

Benno Schulenberg <bens>
Group administrator
Thu 23 Jan 2020 01:57:48 PM UTC, comment #19: 

I tried to find the git commit it worked on, but it didn't work... But now it is glorious! Just from git head. Thank you for all your hard work.

Peter Passchier <pepa65>
Thu 23 Jan 2020 10:47:07 AM UTC, comment #18: 

Fixed in git, commit 1cd5005d.

(The posted patch probably didn't apply for you because git master is a moving target.  Sorry about that.)

Benno Schulenberg <bens>
Group administrator
Thu 23 Jan 2020 10:44:19 AM UTC, comment #17: 

Thanks for the feedback.  Getting ready to push to master.

The reason for going with M-Z and Sh-M-Z (instead of the subtle M-z and M-Z) is not backward compatibility, but 1) that it can be used without needing an option to be set, and 2) that it does not require the user to lowercase any existing M-Z binds in their nanorc.  --  Well, if you want to call the latter backward compatibilty, then yes. :)

Also note that the case doesn't matter: the user can write m-z and sh-m-z if they like.  (Although these are currently colored red in a nanorc; will be fixed later.)

Benno Schulenberg <bens>
Group administrator
Thu 23 Jan 2020 09:28:58 AM UTC, comment #16: 

Sorry, I can't get this patch to work, probably my lack of understanding.

But the main point is that the syntax for describing key combos is now 'M-Z' and 'Sh-M-Z' instead of 'M-z' and 'M-Z' to ensure backwards compatibility, right? Sounds like a great idea, and then 'set splitmeta' is no longer necessary.

Looking forward seeing this in git or in a release!

Peter Passchier <pepa65>
Tue 21 Jan 2020 03:49:01 PM UTC, comment #15: 

Attached is a proposed solution for the Shift+Alt+letter combinations.  Please test and/or comment.

(file #48262)

Benno Schulenberg <bens>
Group administrator
Wed 11 Dec 2019 03:32:13 PM UTC, comment #14: 

There will not be any default shifted Meta bindings because 'splitmeta' will never be the default.

Benno Schulenberg <bens>
Group administrator
Wed 11 Dec 2019 03:25:51 AM UTC, comment #13: 

Even when the CapsLock issue can't be solved, it is still very worthwhile to have this patch, because the vast majority of users don't use CapsLock at all (except accidentally..!), and if some user does use it, a sensible default can be set to use both bindings for the important key combos, like WhereIs Next bound to both Alt-w and Alt-W.

Peter Passchier <pepa65>
Wed 11 Dec 2019 01:28:03 AM UTC, comment #12: 

@ Benno, three-key combos:
M-a/s = markfromlinestart/end + cut
M-A/S = markfromlinestart/end + zap
M-D/F = markfromlinestart/end
^- shift-home+shift-home and shift-end without moving cursor
M-E/Q/W = implants to insert marker and find marker backward/forward
M-B/N/M = prev_cursorreturn/next_cursorreturn/set_cursorreturn
^- stack of cursor positions set before each search jump

@ Peter, vim hasn't solved the capslock issue either, and I couldn't find anything other than an unreliable hack to read the capslocks LED. There are also some issues with shifted implant binds in linux VT, see https://lists.gnu.org/archive/html/nano-devel/2019-12/msg00008.html

Brand Huntsman <brand>
Mon 09 Dec 2019 07:29:51 PM UTC, comment #11: 

It's late at night here and I haven't properly had time to revamp my whole .nanorc, but I have M-n as nextbuf, so I set M-N to be prevbuf (and I think there are a number of places where I can apply this pattern, where the back action is less common).

I have set M-C to wordcount. I use ^Z for undo, and M-z for redo, but now I have another z-slot for suspend (M-Z).

There are probably a number of ^X where I would like to have a reverse as well, so I might rebind those to M-x (and M-X) -- see if the muscle-memory allows me to do that..!

I'll probably use it for the recordmacro (M-X) and runmacro (M-x) -- not with the actual X..!. For now I have it at M-\ and M-|.

This might be another ncurses thing, but it would be nice if there keybindings would keep working consistently while CapsLock is activated (right now, they switch meaning).

Peter Passchier <pepa65>
Mon 09 Dec 2019 07:05:42 PM UTC, comment #10: 

Okay.  Have you already made some differentiated Alt/Shift+Alt bindings?  I'm curious to know what functions you are willing to bind to the more-difficult-to-type three-key combos.

Benno Schulenberg <bens>
Group administrator
Mon 09 Dec 2019 06:46:12 PM UTC, comment #9: 

Oh, I have applied the patch without problems to current git nano, have modified my .nanorc and plan to keep using this binary (or further developed versions).

Interesting to learn about the inherent limitations of ncurses. I guess that is why so many editors choose to not start with it as a base (or manage to break free from it like dex/dte). But I guess for nano using ncurses is the designated path with all it's advantages and disadvantages.

Peter Passchier <pepa65>
Mon 09 Dec 2019 06:12:33 PM UTC, comment #8: 

If you have time, please try out the patch.  It should apply fuzzless (with only offsets) to 4.6.

Yes, when you add 'set splitmeta', then all instances of M-<uppercase> will have to be changed to M-<lowercase> first if you want the normal, shiftless Meta rebinds to continue working.

^X and ^x are inherently indistinguishable.  It is not nano that conflates them, but ncurses.  There is nothing that nano can do about this.

Benno Schulenberg <bens>
Group administrator
Mon 09 Dec 2019 03:50:42 PM UTC, comment #7: 

That is fantastic!! So nano can be made to distinguish Alt and Shift-Alt, that is a breakthrough, I never understood why those were not separate cases. This is great news, and I hope this will be included in future builds.

So this means that all instances of "bind M-X" in one's .nanorc need to become M-x, but all M-X are now available as well..!

How about ^X and ^x, it seems that these are still undistinguished (undistinguishable?).

Peter Passchier <pepa65>
Mon 09 Dec 2019 03:11:23 PM UTC, comment #6: 

This afternoon I realized that nano artificially conflates shifted and unshifted Alt keystrokes.  But it is prefectly possible to distinguish between Alt+a and Alt+A.  Currently nano always translates the former to the latter, and we probably want to keep this the default behavior.  But attached patch no longer conflates the two when 'set splitmeta' is added to the top of your ~/.nanorc file.  This allows adding separate binds for M-a and M-A, for example.  Please try out the patch and let me know whether this is useful to you.

(file #48027)

Benno Schulenberg <bens>
Group administrator
Thu 03 Oct 2019 02:24:52 PM UTC, comment #5: 

I'm sorry for my not help, but at least take my previous examples.

> That emulation is a thing only on Windows.

I doesn't know about that emulation, but the Ctrl+Alt combo it's not that rare.

Tiago Almeida <tjapro>
Thu 03 Oct 2019 12:43:31 PM UTC, comment #4: 

The argument that Ctrl+Alt is sometimes used to emulate AltGr would be an argument against allowing to rebind Ctrl+Alt+letter combinations in nano, as it would be pointless: Ctrl+Alt+letter would produce an accented letter instead of nano seeing a Ctrl+Alt combo.  But, as far as I can see, xkeyboard-config does not provide a setting to make Ctrl+Alt function as AltGr.  That emulation is a thing only on Windows.

Please stop adding comments that are irrelevant.

Benno Schulenberg <bens>
Group administrator
Sun 29 Sep 2019 11:41:07 PM UTC, comment #3: 

Hello!
This request can be strange, but it isn't. In some keyboards, they have the `AltGr` key for some strange characters. It is used with the numbers, accents and punctuation keys. This key is the as `Ctrl+Alt` keys. (https://en.m.wikipedia.org/wiki/AltGr_key)

I'm saying this for some background, but one real example is:
`Ctrl+Z` for Undo.
`Ctrl+Alt+Z`for Redo (the contrary operation).
Or:
`Ctrl+R` for start read a macro.
`Ctrl+Alt+R` for stop read a macro.

I hope I help.

Tiago Almeida <tjapro>
Mon 17 Sep 2018 11:07:07 PM UTC, comment #2: 

If you're for suggestions to extend the default setup, my keybindings are very different from the default. I actually struggle to use nano 'out of the box' on fresh installs with the default key bindings... I am happy to share my bindings if that is of interest.

Having the option of Ctrl-Alt combinations is nice because certain letters have a natural association with certain operations, and some letters can be very 'popular', for example, I have Softwrapping bound to Ctrl-W and Whitespace to Alt-W. If I could bind Wordcount to Ctrl-Alt-W, that would be nice. (Other people might prefer binding Softwrap to Ctrl-Alt-S, having bound Alt-S to Writeout and Ctrl-S to Savefile.)

Peter Passchier <pepa65>
Mon 17 Sep 2018 06:54:45 PM UTC, comment #1: 

Which functions would you wish to bind to Ctrl+Alt combinations?

Benno Schulenberg <bens>
Group administrator
Thu 13 Sep 2018 07:29:32 PM UTC, original submission:  

According to the discussion in bug #54643:

When I am in an nano, in a terminal, in a desktop environment/window manager, some Alt / Ctrl /Ctrl-Alt combinations are taken, not available for rebind within nano. But for some people (like me) a certain Alt-Ctrl combination would make sense and are more memorable, and would make nano functions more accessible.

Peter Passchier <pepa65>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by brand (Posted a comment)
  • -email is unavailable- added by tjapro (Posted a comment)
  • -email is unavailable- added by bens (Posted a comment)
  • -email is unavailable- added by pepa65 (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 10 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-02-09 bens Open/ClosedOpen Closed
    2020-01-23 bens Summary[Request] make Ctrl+Alt+letter combinations bindable [Request] make modified Alt+letter combinations bindable
    2020-01-23 bens StatusIn Progress Fixed
    2020-01-21 bens Attached File- Added 0001-bindings-allow-to-bind-shifted-Meta-letter-combinati.patch, #48262
        StatusNeed Info In Progress
        Assigned toNone bens
    2019-12-09 bens Attached File- Added 0001-input-allow-distinguishing-shifted-from-unshifted-Me.patch, #48027
        StatusNone Need Info
    2018-09-17 bens Severity3 - Normal 1 - Wish
        SummaryFeature request: make Ctrl-Alt-key combinations bindable [Request] make Ctrl+Alt+letter combinations bindable

    Back to the top

    Powered by Savane 3.13-3230.
    Corresponding source code