feat: improve key detection (#2496)

* feat: improve key detection

* docs: update `CHANGELOG.md`

* docs: update documentation
This commit is contained in:
CatsDeservePets authored and GitHub committed 2026-04-08 01:36:33 +02:00
1 parent 88e97d1f35
commit 779bffb3dc
5 files changed
+15 -10

No files matched your search

+1
View File
@@ -21,6 +21,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
### Added ### Added
- Emoji sequences containing Zero Width Joiner characters are now displayed as a single combined glyph (#2286). - Emoji sequences containing Zero Width Joiner characters are now displayed as a single combined glyph (#2286).
- Key combinations such as `<c-h>` and `<backspace>` can now be distinguished when supported by the terminal (#2286) (#2496).
- A new field `.All` is added to the `ruler` file to display the number of all files (i.e. visible + hidden) in the current working directory (#2376). - A new field `.All` is added to the `ruler` file to display the number of all files (i.e. visible + hidden) in the current working directory (#2376).
- A new option `numbercursorfmt` is added to further customize the appearance of line numbers (#2395). - A new option `numbercursorfmt` is added to further customize the appearance of line numbers (#2395).
- A new option `terminalcursor` is added to customize the appearance of the terminal cursor (#2441). - A new option `terminalcursor` is added to customize the appearance of the terminal cursor (#2441).
+1 -1
View File
@@ -1613,7 +1613,7 @@ Some special keys and modifiers use different names and separators, and key name
map <m-up> down # not <ScrollWheelUp> map <m-up> down # not <ScrollWheelUp>
WARNING: Some key combinations will likely be intercepted by your OS, window manager, or terminal. WARNING: Some key combinations will likely be intercepted by your OS, window manager, or terminal.
Other key combinations cannot be recognized by lf due to the way terminals work (e.g. `Ctrl+h` combination sends a backspace key instead). Other key combinations may not be distinguishable by lf, depending on how the terminal reports them (e.g. `Ctrl+h` may be reported as `backspace` instead).
The easiest way to find out the name of a key combination and whether it will work on your system is to press the key while lf is running and read the name from the `unknown mapping` error. The easiest way to find out the name of a key combination and whether it will work on your system is to press the key while lf is running and read the name from the `unknown mapping` error.
Mouse buttons are prefixed with an `m` character: Mouse buttons are prefixed with an `m` character:
+6 -5
View File
@@ -1772,11 +1772,12 @@ no aliases), so some familiar forms will not work:
map <m-up> down # not <ScrollWheelUp> map <m-up> down # not <ScrollWheelUp>
WARNING: Some key combinations will likely be intercepted by your OS, WARNING: Some key combinations will likely be intercepted by your OS,
window manager, or terminal. Other key combinations cannot be recognized window manager, or terminal. Other key combinations may not be
by lf due to the way terminals work (e.g. Ctrl+h combination sends a distinguishable by lf, depending on how the terminal reports them (e.g.
backspace key instead). The easiest way to find out the name of a key Ctrl+h may be reported as backspace instead). The easiest way to find
combination and whether it will work on your system is to press the key out the name of a key combination and whether it will work on your
while lf is running and read the name from the unknown mapping error. system is to press the key while lf is running and read the name from
the unknown mapping error.
Mouse buttons are prefixed with an m character: Mouse buttons are prefixed with an m character:
+3
View File
@@ -105,9 +105,12 @@ var gKeyVal = map[tcell.Key]string{
tcell.KeyCtrlE: "<c-e>", tcell.KeyCtrlE: "<c-e>",
tcell.KeyCtrlF: "<c-f>", tcell.KeyCtrlF: "<c-f>",
tcell.KeyCtrlG: "<c-g>", tcell.KeyCtrlG: "<c-g>",
tcell.KeyCtrlH: "<c-h>",
tcell.KeyCtrlI: "<c-i>",
tcell.KeyCtrlJ: "<c-j>", tcell.KeyCtrlJ: "<c-j>",
tcell.KeyCtrlK: "<c-k>", tcell.KeyCtrlK: "<c-k>",
tcell.KeyCtrlL: "<c-l>", tcell.KeyCtrlL: "<c-l>",
tcell.KeyCtrlM: "<c-m>",
tcell.KeyCtrlN: "<c-n>", tcell.KeyCtrlN: "<c-n>",
tcell.KeyCtrlO: "<c-o>", tcell.KeyCtrlO: "<c-o>",
tcell.KeyCtrlP: "<c-p>", tcell.KeyCtrlP: "<c-p>",
+4 -4
View File
@@ -1,6 +1,6 @@
.\" Automatically generated by Pandoc 3.7.0.2 .\" Automatically generated by Pandoc 3.7.0.2
.\" .\"
.TH "LF" "1" "2026\-03\-21" "r42" "DOCUMENTATION" .TH "LF" "1" "2026\-04\-08" "r42" "DOCUMENTATION"
.SH NAME .SH NAME
lf \- terminal file manager lf \- terminal file manager
.SH SYNOPSIS .SH SYNOPSIS
@@ -1615,9 +1615,9 @@ map <m\-up> down # not <ScrollWheelUp>
.PP .PP
WARNING: Some key combinations will likely be intercepted by your OS, WARNING: Some key combinations will likely be intercepted by your OS,
window manager, or terminal. window manager, or terminal.
Other key combinations cannot be recognized by lf due to the way Other key combinations may not be distinguishable by lf, depending on
terminals work (e.g. how the terminal reports them (e.g.
\f[CR]Ctrl+h\f[R] combination sends a backspace key instead). \f[CR]Ctrl+h\f[R] may be reported as \f[CR]backspace\f[R] instead).
The easiest way to find out the name of a key combination and whether it The easiest way to find out the name of a key combination and whether it
will work on your system is to press the key while lf is running and will work on your system is to press the key while lf is running and
read the name from the \f[CR]unknown mapping\f[R] error. read the name from the \f[CR]unknown mapping\f[R] error.