micro
micro copied to clipboard
TTY login: some keycombos do not work in editor 'micro'
When logging via Ctrl+Alt+F1, and opening the text editor micro, some key combinations do not work. Ctrl+Home and Ctrl+End do not work at all. Ctrl+Q and Ctrl+S work only if I press the Control key on the left side, if I press the Control key on the right side it does not work. Environment variables: TERM=linux, SHELL=zsh.
Version: 2.0.10 Commit hash: b9763856 Compiled on May 01, 2022 OS: Arch Linux Terminal: Console (no X11, no Xwayland) Login manager: LY
https://github.com/zyedidia/micro/wiki/Linux-Console-Keybindings
Duplicate of: https://github.com/zyedidia/micro/issues/802 https://github.com/zyedidia/micro/issues/1396
execute this bash command to fix the issue
#!/bin/bash
tmp=$(mktemp)
cat >$tmp <<EOL
# Right
control keycode 106 = F100
shift keycode 106 = F101
control shift keycode 106 = F102
# Left
control keycode 105 = F103
shift keycode 105 = F104
control shift keycode 105 = F105
# Up
shift keycode 103 = F106
# Down
shift keycode 108 = F107
string F100 = "\033[1;5C"
string F101 = "\033[1;2C"
string F102 = "\033[1;6C"
string F103 = "\033[1;5D"
string F104 = "\033[1;2D"
string F105 = "\033[1;6D"
string F106 = "\033[1;2A"
string F107 = "\033[1;2B"
EOL
sudo loadkeys "$tmp"
The linked solution was enough to make selection work in micro in tmux in tty2 for me, but without tmux interposed I'm back to seeing the escape sequences printed into the text.
I see there's no longer a KeyShfRight in https://github.com/zyedidia/tcell/blob/master/terminfo/l/linux/term.go —there was at the time #802 was fixed by https://github.com/zyedidia/tcell/commit/37b78458fe9cbcbdd74fc579537aa13f50eb9f2f, and then it disappeared in the database split in https://github.com/zyedidia/tcell/commit/8f0846977269a85991c04ce90a04a9f6610c5421. But I'm in over my head at this point—I can't tell if that's a regression, or if it's supposed to be covered by tricks matching on xterm-like kRIT (https://github.com/zyedidia/tcell/commit/0608abe29747d0ccd9a871c27628d2e74c671c10), or how much the terminfo database on my specific device matters (I checked that infocmp linux | grep kRIT is empty, unlike infocmp xterm | grep kRIT).
For me, the script given by ManuLinares works only if I also set TERM to xterm in the shell or set xterm to true in micro's options. Otherwise (when TERM is set to linux and micro's xterm option is false (default)), micro outputs the key codes into the edited text.
Ubuntu 23.04 Micro 2.0.11