Skip to content

Commit 3eb6be8

Browse files
author
Jakub Horký
committed
lib/tty/key.c: Add Kitty Keyboard Protocol support
The protocol is described here: https://sw.kovidgoyal.net/kitty/keyboard-protocol/ Check for kitty sequence when no entry is found in the keys tree, before the sequence is discarded. Resolves: #4762 Signed-off-by: Jakub Horký <jakub.git@horky.net>
1 parent 06d5543 commit 3eb6be8

21 files changed

Lines changed: 417 additions & 122 deletions

File tree

doc/man/es/mc.1.in

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3965,6 +3965,13 @@ For example:
39653965
.nf
39663966
autodetect_codeset=russian
39673967
.fi
3968+
.TP
3969+
.I kitty_keyboard_protocol
3970+
De forma predeterminada, Midnight Commander envía una secuencia de escape que habilita el
3971+
protocolo de teclado de Kitty, lo que permite un manejo preciso del teclado (incluyendo
3972+
combinaciones de teclas como C\-Enter o C\-S\-Enter) cuando se conecta desde terminales
3973+
que admiten este protocolo. Si se establece en falso, Midnight Commander no intentará
3974+
habilitar este protocolo.
39683975
.\"NODE "Parameters for external editor or viewer"
39693976
.SH "Parámetros para editor o visor externo"
39703977
Midnight Commander permite especificar opciones para editores y visores

doc/man/hu/mc.1.in

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3014,6 +3014,14 @@ utolsó fájl a panelben.
30143014
.IP
30153015
Ha ez a változó be van állítva (alapértelmezésben) meg foja jelölni azt
30163016
a fájl parancsot, amelyhez a
3017+
.PP
3018+
.I kitty_keyboard_protocol
3019+
Alapértelmezés szerint a Midnight Commander egy olyan escape szekvenciát
3020+
küld, amely engedélyezi a Kitty billentyűzetprotokollt. Ez lehetővé teszi
3021+
a billentyűzet pontos kezelését (beleértve az olyan billentyűkombinációkat
3022+
is, mint a C\-Enter vagy a C\-S\-Enter), amikor olyan terminálról
3023+
csatlakoznak, amely támogatja ezt a protokollt. Ha az érték hamisra van
3024+
állítva, a Midnight Commander nem próbálja meg engedélyezni ezt a protokollt.
30173025
.\"LINK2"
30183026
Társításokban
30193027
.\"Edit Extension File"

doc/man/it/mc.1.in

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3014,6 +3014,14 @@ pannello.
30143014
.I use_file_to_guess_type
30153015
Se questa variabile è abilitata (valore predefinito) userà il comando
30163016
file per trovare delle corrispondenze sui tipi di file elencati nel
3017+
.TP
3018+
.I kitty_keyboard_protocol
3019+
Per impostazione predefinita, Midnight Commander invia una sequenza di
3020+
escape che abilita il Kitty Keyboard Protocol, il quale consente una
3021+
gestione precisa della tastiera (incluse combinazioni di tasti come
3022+
C\-Enter o C\-S\-Enter) quando ci si connette da terminali che supportano
3023+
questo protocollo. Se impostato su false, Midnight Commander non tenterà
3024+
di abilitare questo protocollo.
30173025
.\"LINK2"
30183026
file mc.ext.ini\&.
30193027
.\"Edit Extension File"

doc/man/mc.1.in

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4208,6 +4208,13 @@ For example:
42084208
.nf
42094209
autodetect_codeset=russian
42104210
.fi
4211+
.TP
4212+
.I kitty_keyboard_protocol
4213+
By default, Midnight Commander sends an escape sequence that enables the Kitty
4214+
Keyboard Protocol, which allows precise keyboard handling (including key
4215+
combinations such as C\-Enter or C\-S\-Enter) when connected from terminals that
4216+
support this protocol. If set to false, Midnight Commander will not attempt to
4217+
enable this protocol.
42114218
.\"NODE "Parameters for external editor or viewer"
42124219
.SH "Parameters for external editor or viewer"
42134220
Midnight Commander provides a way for specify an options for external editors

doc/man/pl/mc.1.in

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2708,6 +2708,13 @@ Jeśli ta opcja jest włączona (standardowo tak nie jest) kiedy przeglądasz pl
27082708
w panelu drzewa, będzie on automatycznie przeładowywał drugi panel na
27092709
zawartość wybranego katalogu.
27102710
.PP
2711+
.I kitty_keyboard_protocol
2712+
Domyślnie Midnight Commander wysyła sekwencję escape, która włącza protokół
2713+
klawiatury Kitty. Umożliwia on precyzyjną obsługę klawiatury (w tym kombinacje
2714+
klawiszy takie jak C\-Enter czy C\-S\-Enter) podczas połączenia z terminalami
2715+
obsługującymi ten protokół. Jeśli ustawione na false, Midnight Commander
2716+
nie będzie próbował włączyć tego protokołu.
2717+
.PP
27112718
.\"NODE "Terminal databases"
27122719
.SH Baza danych terminali (Terminal databases)
27132720
Midnight Commander pozwala ci na naprawienie bazy danych terminali bez

doc/man/ru/mc.1.in

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4663,6 +4663,13 @@ clipboard_paste=xclip \-o
46634663
.nf
46644664
autodetect_codeset=russian
46654665
.fi
4666+
.PP
4667+
.I kitty_keyboard_protocol
4668+
По умолчанию Midnight Commander отправляет управляющую последовательность, которая
4669+
включает протокол клавиатуры Kitty. Этот протокол обеспечивает точную обработку
4670+
клавиатуры (включая такие комбинации клавиш, как C\-Enter или C\-S\-Enter) при
4671+
подключении из терминалов, поддерживающих данный протокол. Если установить значение
4672+
в false, Midnight Commander не будет пытаться включить этот протокол.
46664673
.\"NODE "Parameters for external editor or viewer"
46674674
.SH "Параметры для внешних редакторов и программ просмотра"
46684675
Midnight Commander позволяет задать некоторые параметрыы для внешних редакторов

doc/man/sr/mc.1.in

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4044,6 +4044,14 @@ clipboard_paste=xclip \-o
40444044
.nf
40454045
autodetect_codeset=russian
40464046
.fi
4047+
.TP
4048+
.I kitty_keyboard_protocol
4049+
Подразумевано, Midnight Commander шаље escape секвенцу која омогућава
4050+
Kitty протокол тастатуре, што омогућава прецизно руковање тастатуром
4051+
(укључујући комбинације тастера као што су C\-Enter или C\-S\-Enter)
4052+
када се повезује са терминала који подржавају овај протокол. Ако је
4053+
постављено на false, Midnight Commander неће покушати да омогући овај
4054+
протокол.
40474055
.\"NODE "Parameters for external editor or viewer"
40484056
.SH "Параметри спољашњег уређивача или прегледача"
40494057
Поноћни наредник обезбеђује начин да се задају опције за спољашње уређиваче и

lib/global.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@ mc_global_t mc_global =
103103
.disable_colors = FALSE,
104104
.ugly_line_drawing = FALSE,
105105
.old_mouse = FALSE,
106-
.alternate_plus_minus = FALSE
106+
.alternate_plus_minus = FALSE,
107+
.kitty_keyboard_protocol = TRUE
107108
},
108109

109110
.vfs =

lib/global.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,10 @@ typedef struct
206206
/* If true, use + and \ keys normally and select/unselect do if M-+ / M-\.
207207
and M-- and keypad + / - */
208208
gboolean alternate_plus_minus;
209+
210+
// If true, send Kitty Keyboard Protocol initialization string to the terminal
211+
// Defaults to true, because terminals that don't support it simply do nothing
212+
gboolean kitty_keyboard_protocol;
209213
} tty;
210214

211215
struct

lib/terminal.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ parse_csi (csi_command_t *out, const char **sptr, const char *end)
156156
{
157157
out->private_mode = private_mode;
158158
out->param_count = param_count;
159+
out->final_byte = c;
159160
}
160161

161162
invalid_sequence:

0 commit comments

Comments
 (0)