Commit Graph

87 Commits

Author SHA1 Message Date
Павел Мешалкин
8ffdf7d7ee feat: add per-mapping --allow-fallback for layout-independent shortcuts
Add --allow-fallback option to the map command that controls shifted
and ascii (alternate_key) fallback for individual key mappings.

For non-Latin keyboard layouts, when the current layout key is
non-ascii (codepoint > 127 and < 0xE000), the alternate_key from
the base layout is used for matching if the mapping opts in via
--allow-fallback=shifted,ascii.

Default kitty bindings use --allow-fallback=shifted,ascii so they
work out of the box with non-Latin layouts. User custom mappings
default to --allow-fallback=shifted (preserving existing shifted_key
behavior without ascii fallback).

--allow-fallback=none disables all fallback for a mapping.

Python side: parse_options_for_map() in options/utils.py handles flag
parsing, ShortcutMapping uses it in __init__. get_shortcut() filters
candidates by per-mapping allow_fallback.

Go side: ParseMap() handles --allow-fallback, KeyAction stores
AllowFallback, ShortcutTracker.Match passes it to matching.
MatchesParsedShortcut defaults to shifted,ascii for hardcoded shortcuts.

Migrated kittens (themes, command_palette, diff, choose_files) to
use ShortcutTracker with configurable map entries.

Tests added for Python (5 test methods) and Go (ParseMap + key matching).
2026-03-25 19:34:13 +03:00
Kovid Goyal
d1b9b5ac4f themes kitten: Also underline trigger keys on confirmation page. Apparently some people use color themes where SGR 31 does not contrast with the default foreground color. 2026-01-02 11:24:11 +05:30
Kovid Goyal
4713cc29ad make gofmt happy 2025-05-16 09:40:34 +05:30
Kovid Goyal
c861259e3b Rename go module from kitty -> github.com/kovidgoyal/kitty
Makes the code more easily re-useable in other projects
2025-05-16 08:43:39 +05:30
Kovid Goyal
e42d410ee4 Move cli spec parsing code into simple module 2025-04-28 09:20:10 +05:30
Kovid Goyal
da1626090a Update codebase to Python 3.10 using pyupgrade 2025-02-03 10:56:50 +05:30
Kovid Goyal
2d02ff1c5f Implement using effective kitty config options for kittens
Also centralise reading of kitty options
2025-01-05 20:16:43 +05:30
Kovid Goyal
35b3ae8edb Revert "themes kitten: When using the Default theme as an auto switch theme include all the actual settings values"
This reverts commit 2abc0be844.
2024-12-20 12:54:47 +05:30
Kovid Goyal
2abc0be844 themes kitten: When using the Default theme as an auto switch theme include all the actual settings values
Fixes #8124
2024-12-16 15:32:32 +05:30
Kovid Goyal
96c1a5c4d1 Get automatic theme switching working 2024-11-07 17:31:44 +05:30
Kovid Goyal
62d5e13cbd themes kitten: fix some keybaord shortcuts not working with weird IME systems on Linux that convert key events into text events 2024-10-15 09:51:52 +05:30
Ethan Wu
87a9a60442 Fix themes kitten not displaying colors in narrow windows
The themes kitten used the truncated color name when formatting the
colors themselves, which leads to broken coloring when the window is
narrow enough to cause truncation to occur.
2024-07-08 22:41:29 -07:00
Kovid Goyal
405f5ce148 Use stdlib maps/slices 2024-06-24 07:54:13 +05:30
Kovid Goyal
2bcd47227c Wire up arrow keys for moving in family list 2024-06-24 07:54:12 +05:30
Kovid Goyal
0864c2728d Wire up searching 2024-06-24 07:54:12 +05:30
Kovid Goyal
4b282211de Fix #7276 2024-03-28 18:15:10 +05:30
Kovid Goyal
5fb661d72d ... 2023-10-05 09:34:21 +05:30
Kovid Goyal
7faf216f9e More linter fixes 2023-09-18 20:59:47 +05:30
Kovid Goyal
0bc4f8076e Fix #6410 2023-07-02 07:31:14 +05:30
Kovid Goyal
ce70320a62 ... 2023-05-04 10:26:18 +05:30
Kovid Goyal
3eb18a416a Entry point for parsing theme metadata 2023-05-04 10:14:58 +05:30
Kovid Goyal
1dd3490611 Fix #6160 2023-04-06 15:14:21 +05:30
Kovid Goyal
9919767aef Remove unused code 2023-03-30 10:26:39 +05:30
Kovid Goyal
ff55121094 Move the kittens Go code into the kittens folder 2023-03-27 13:06:02 +05:30
Kovid Goyal
9443b0e361 Remove themes python code 2023-03-14 20:28:45 +05:30
Kovid Goyal
6794ec1de7 Wire up the new subseq match code 2023-03-14 12:29:44 +05:30
Kovid Goyal
f9b0b54ee5 Start work on porting themes kitten to Go 2023-03-14 12:29:44 +05:30
Kovid Goyal
d4e34a4c31 themes kitten: Nicer error message when no internet connection is present
Fixes #5877
2023-01-11 09:00:58 +05:30
Kovid Goyal
7fe5d7b58f Replace isort with ruff 2023-01-09 16:47:42 +05:30
Kovid Goyal
4e90ae68a4 ... 2023-01-06 11:33:47 +05:30
Kovid Goyal
e16e3c1582 Clarify the common use case for --config-file-name 2023-01-06 10:42:46 +05:30
pagedown
a131f9a82e Refactor: Use a consistent name for beam cursor shape 2022-11-19 10:34:50 +08:00
Kovid Goyal
7737369fc9 Add completion for the kittens 2022-11-14 15:41:58 +05:30
James Reid
0b79cbdb3b Add "user" tab to themes kitten
Add new tab named "user" to the built-in themes kitten - new tab
filters and displays only user-defined color themes, identified by
adding "is_user_defined" property to "Theme" class which defaults
to False, and is set True when a theme is fetched using the
"load_from_dir" method.
2022-05-30 19:25:09 +01:00
James Reid
1dc6b49e02 Remove hard coded tab string in ThemesHandler
Remove hard coded tab string and replace with self.tabs, which is
a reference to the same tab string defined in the __init__ of
ThemesHandler
2022-05-30 19:17:07 +01:00
Kovid Goyal
c3b23679f3 Make some themes code re-useable 2022-04-08 11:33:50 +05:30
pagedown
80a62c8d71 Add preamble to generated file and fix gen-config.py filename 2022-02-05 13:05:13 +08:00
pagedown
4a3ed62809 Refactor: More f-string for kittens 2022-01-29 20:23:34 +08:00
Kovid Goyal
5cdff7d6d0 themes kitten: Allow writing to a different file than kitty.conf 2022-01-27 20:24:39 +05:30
pagedown
7246fb347c Remove the unused function 2022-01-01 21:29:06 +08:00
Kovid Goyal
f71e0a6ee8 ... 2021-12-21 10:39:06 +05:30
Kovid Goyal
4448444d4b Fix #4289 2021-11-28 11:47:25 +05:30
Kovid Goyal
ecea1ba241 ... 2021-11-21 10:05:47 +05:30
Kovid Goyal
5c7a1d1b05 Fix typo 2021-11-17 15:19:17 +05:30
Kovid Goyal
0f23edeec3 Fix breakage caused by Color no longer being iterable 2021-11-07 07:15:55 +05:30
pagedown
b4a6ed8d8f Allows the visual bell color to be configured 2021-11-02 19:38:36 +08:00
Kovid Goyal
39dcfb4e5d Auto generate the list of all color config keys 2021-11-02 15:16:55 +05:30
Kovid Goyal
2443dc135c Use a faster implementation of the Color type
Now implemented in C
2021-10-28 11:15:13 +05:30
Kovid Goyal
a26f041964 Add more type annotations 2021-10-27 12:31:10 +05:30
Kovid Goyal
4494ddd8ff mypy: Turn on return value checks
Its a shame GvR is married to "return None"
https://github.com/python/mypy/issues/7511
2021-10-26 22:39:14 +05:30