[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mutt-users
Subject:    Re: bind index <S-Return> ...
From:       Remco =?utf-8?Q?R=C4=B3nders?= <remco () webconquest ! com>
Date:       2020-10-12 13:24:55
Message-ID: X4RZJ4lKiZsPMNsQ () settler
[Download RAW message or body]

On Mon, Oct 12, 2020 at 06:30:02AM -0400, Philippe wrote in 
<20201012103002.GA67777@ccs.neu.edu>:
>I'm trying to create some bindings in my .muttrc file for mutt's sidebar
>(this is while running mutt in an xterm window on OpenBSD):

>bind index <S-Return> sidebar-open
>
>and it does not work at all: mutt seems to consider pressing the
>Shift-Enter combination on the keyboard to be the same as just pressing
>Enter.  Indeed executing the what-key function shows that the Shift-Enter
>key combination is just recognized as Return by mutt.

>I also tried emacs's view-lossage function in the same xterm and emacs
>recognizes the Shift-Enter key combination as: ESC [ 2 7 ; 2 ; 1 3 ~
>So out of desperation I tried this in my .muttrc:
>
>bind index "\e[27;2;13~" sidebar-open
>
>and then this:
>
>bind index \e[27\;2\;13~ sidebar-open
>
>Neither gives me any error message from mutt but then neither works either.
>
>So... is there a way to make Shift-Enter work?

Hi Philippe,

[Disclaimer: I am only 80% sure about the below, if anyone else knows better, I
am happy to be corrected and learn too]

Long story short: You may want to pick another key combination to bind.

Short story long: Mutt doesn't really play a role here and it takes just the
commands as received from the environment (terminal emulator and shell) it is
running in.  The reason that Enter and Shift-Enter results in the same response
from mutt is that mutt receives the same input from this environment for both
key (combination)s.  You can see this for yourself by typing Ctrl-V inside your
xterm followed by any key and it will show you the same control code for both.
I notice that on my system Alt + Enter is mapped differently and that all other
modifier keys in combination with Enter all return the same result.  You might
be able to change this by ensuring that both key combinations are mapped
differently.  If this is possible and how to do this depends on your
environment. I have not tried this myself, but it seems (a combination of) X
resources or keymaps might get you what you want. Just be aware that the effort
might be greater than the pay off for you unless someone else has some cookie
cutter configuration snippets you can use.  A quick google suggested to me there
might not be a one size fits all solution for this.

Why does it work in emacs then? Emacs overrides/changes the keymaps used and
thus is able to distinguish between the two. Mutt makes no such attempt and thus
can only act on what it is passed from its environment.

I know this might not answer your question, but hopefully it can help you find a
solution or an alternative.

Kind regards,

Remco
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic