Ticket #4139 (closed enhancement: invalid)

Opened 3 years ago

Last modified 3 years ago

Make McEdit recognize the alt-ctrl-… keys

Reported by: psprint Owned by:
Priority: major Milestone:
Component: mc-tty Version: master
Keywords: keybindings, bindings, keys, mappings Cc:
Blocked By: Blocking:
Branch state: no branch Votes for changeset:


I've noted that mcedit doesn't capture the Alt-Ctrl-… key strokes. They are fully legal keys, being represented by the sequences: ESC(^[)-Ctrl(^)key, e.g.: ^[^g for Alt-Ctrl-g.

Could the support for the keys be added to the editor? They would greatly increase the available key-space, making it possible to create a more memorable mappings (like when e.g.: "oh no, ctrl-n, alt-n and alt-shift-n are all already taken, where will I map EditNewFile??", the answer: "to ctrl-alt-n" ;)).

Change History

comment:1 Changed 3 years ago by psprint

Also, why doesn't alt-space work? cat -v shows it produces the expected escape followed by a space, i.e. ^[char(0x20), so I think that it should be supported?

comment:2 Changed 3 years ago by angel_il

my Xterm config:

xterm*decTerminalID: vt340
XTerm*foreground: green
XTerm*cursorColor: darkgreen
XTerm*background: black
XTerm*scrollBar: False
XTerm*saveLines: 1000
XTerm*metaSendsEscape: true
XTerm*selectToClipboard: true
XTerm.omitTranslation: fullscreen
XTerm*font1:	-xos4-terminus-medium-r-*-*-12-*-*-*-*-*-iso10646-1
XTerm*font2:	-xos4-terminus-medium-r-*-*-14-*-*-*-*-*-iso10646-1
XTerm*font3:	-xos4-terminus-medium-r-*-*-16-*-*-*-*-*-iso10646-1
XTerm*font4:	-xos4-terminus-medium-r-*-*-20-*-*-*-*-*-iso10646-1
XTerm*font5:	-xos4-terminus-medium-r-*-*-22-*-*-*-*-*-iso10646-1
XTerm*font6:	-xos4-terminus-medium-r-*-*-28-*-*-*-*-*-iso10646-1
XTerm*font: -xos4-terminus-medium-r-*-*-22-*-*-*-*-*-iso10646-1
XTerm*VT100.Translations: #override                               \n\
    Ctrl        <Key>KP_Divide:   string(0x1b)  string("[7;OQ~")  \n\
    Ctrl        <Key>KP_Multiply: string(0x1b)  string("[7;OR~")  \n\
    Ctrl        <Key>KP_Subtract: string(0x1b)  string("[7;OS~")  \n\
    Ctrl        <Key>KP_Add:      string(0x1b)  string("[7;Ol~")  \n\
    Shift Ctrl  <Key>Tab:         string(0x1b)  string("[~Z")     \n\
    Ctrl        <Key>Tab:         string(0x1b)  string("[z")      \n\
	Shift Ctrl	<Key>Prior:       string(0x1b)  string("[5;6~")   \n\
	Shift 	    <Key>Prior:       string(0x1b)  string("[5;2~")   \n\
	Shift Ctrl	<Key>Next:        string(0x1b)  string("[6;6~")   \n\
	Shift 	    <Key>Next:        string(0x1b)  string("[6;2~")   \n\
	Shift       <Key>Insert:      string(0x1b)  string("[2;2~")   \n\
    <Btn1Down>:       select-start(CLIPBOARD)                     \n\
    <Btn1Up>:         select-end(PRIMARY,CLIPBOARD,CUT_BUFFER0)   \n\
    Shift <Btn1Down>: ignore()                                    \n\
    Shift <Btn1Up>:   select-end(PRIMARY,CLIPBOARD,CUT_BUFFER0)   \n\
    <Btn2Down>:       select-start(CLIPBOARD)                     \n\
    <Btn2Up>:         select-end(PRIMARY,CLIPBOARD,CUT_BUFFER0)   \n\
    Shift <Btn2Down>: select-start(CLIPBOARD)                     \n\
    Shift <Btn2Up>:   select-end(PRIMARY,CLIPBOARD,CUT_BUFFER0)   \n\
    <Btn3Down>:       ignore()                                    \n\
    <Btn3Up>:         insert-selection(PRIMARY,CLIPBOARD)         \n\
    Shift <Btn3Down>: ignore()                                    \n\
    Shift <Btn3Up>:   insert-selection(PRIMARY,CLIPBOARD)         \n\
    Meta   <Key>F9:   fullscreen()

comment:3 Changed 3 years ago by angel_il

my ini file (xterm section)

ctrl f1=\\e[11\;5
ctrl f2=\\e[12\;5
ctrl f3=\\e[13\;5
ctrl f4=\\e[14\;5
ctrl alt right=\\e\\e[C
ctrl alt left=\\e\\e[D
ctrl alt up=\\e\\e[A
ctrl alt down=\\e\\e[B
alt right=\\e\\eOC
alt left=\\e\\eOD
alt up=\\e\\eOA
alt down=\\e\\eOB
alt end=\\e\\e[4~
alt home=\\e\\e[1~
alt pgup=\\e\\e[5~
alt pgdn=\\e\\e[6~
ctrl right=\\e[C
ctrl left=\\e[D
ctrl up=\\e[A
ctrl down=\\e[B
ctrl home=\\e[1\;5H
ctrl end=\\e[1\;5F
ctrl pgup=\\e[[5\;5~
ctrl pgdn=\\e[[6\;5~
alt end=\\e\\e[4~
alt home=\\e\\e[1~
alt pgup=\\e\\e[5~
alt pgdn=\\e\\e[6~
alt f7=\\e\\e[18~
alt 1=\\e1
alt 2=\\e2
alt 3=\\e3
alt 4=\\e4
alt 5=\\e5





alt shift right=\\e[1\;4C
alt shift left=\\e[1\;4D










comment:4 Changed 3 years ago by angel_il

all keys what i need works.

comment:5 Changed 3 years ago by psprint

Thanks for sharing the method of overriding the keys meanings. I think that it'll be useful to me.

Surprisingly, the ctrl-alt-… bindings started to work on a new system. Apparently the ones that I've tried before were overlapping with the window manager's ones. So this issue is resolved now.

However, I still cannot map alt-space. I've tried overriding with the [terminal:xterm] section of the ini file, by entering e.g.:

alt space =\\ex

Just as an experiment to see if pressing Alt-x will trigger alt-space bindings and it did not.

So it seems that overriding the binding's meaning is also blocked, not only binding it. Or maybe it's the binding that's blocked and that's why even the original, not-overridden key sequence (i.e.: ^[char(0x20)) doesn't work.

comment:6 Changed 3 years ago by psprint

Update: I've used the [terminal:TERNAME] section with a correct terminal name this time and I was able to override the alt-space key so that it works. So this issue is now resolved too.

comment:7 Changed 3 years ago by andrew_b

  • Status changed from new to closed
  • Resolution set to invalid
  • Component changed from mcedit to mc-tty
  • Milestone Future Releases deleted



Note: See TracTickets for help on using tickets.