From 9ed971cc90c9d65def3c52178578e43f29b68f9f Mon Sep 17 00:00:00 2001 From: Massimo Mund Date: Fri, 5 Sep 2025 07:56:51 +0200 Subject: Add keybindings for CTRL, ALT, SHIFT + UP, DOWN, RIGHT, LEFT, HOME, END, BACKSPACE, DELETE & more (#3996) * Added tests for `LightRenderer` * Added common SHIFT, ALT and ALT+SHIFT key sequences * Added common CTRL key sequences * Added common CTRL+ALT, CTRL+SHIFT, CTRL+ALT+SHIFT key sequences * Added proper xterm META modifier handling according to https://github.com/joejulian/xterm/blob/defc6dd5684a12dc8e56cb6973ef973e7a32caa3/input.c#L357-L375 * Fix `ctrl-backspace` and `ctrl-alt-backspace` * Fix broken tcell tests on windows by swallowing Resize events * Added tests for FullscreenRenderer * Removed own fork of tcell and updated tcell to 2.9.0 tcell 2.9.0 is needed for `Ctrl-Alt-*` and `Ctrl-Alt-Shift-*` shortcuts in Windows * Replace conditional checks with switch statements to improve readability * Replace long conditionals with constant slices to improve readability * Bind `ctrl-bspace` (`ctrl-h`) to `backward-delete-char` by default Since we now distinguish between Backspace and Ctrl-Backspace, Ctrl-Backspace should trigger the same action as Backspace by default. In that way nothing changes for the user but you can bind other actions to Ctrl-Backspace when desired. --- src/terminal.go | 1 + 1 file changed, 1 insertion(+) (limited to 'src/terminal.go') diff --git a/src/terminal.go b/src/terminal.go index dfcc7f3d..f3f5298b 100644 --- a/src/terminal.go +++ b/src/terminal.go @@ -782,6 +782,7 @@ func defaultKeymap() map[tui.Event][]*action { add(tui.CtrlF, actForwardChar) add(tui.CtrlH, actBackwardDeleteChar) add(tui.Backspace, actBackwardDeleteChar) + add(tui.CtrlBackspace, actBackwardDeleteChar) add(tui.Tab, actToggleDown) add(tui.ShiftTab, actToggleUp) add(tui.CtrlJ, actDown) -- cgit v1.2.3