Cleanup previous PR

This commit is contained in:
Kovid Goyal
2026-02-25 19:40:38 +05:30
parent 3108c0bc81
commit d56958f61a
3 changed files with 8 additions and 9 deletions

View File

@@ -175,6 +175,8 @@ Detailed list of changes
- Fix a regression that broke using line numbers with the edit-in-kitty command
(:pull:`9346`)
- Key maps: Allow specifying a timeout for multi key mappings and keyboard modes (:pull:`9551`)
- macOS: Fix changes to :opt:`macos_titlebar_color` while in full screen not being applied after exiting fullscreen (:iss:`9350`)
- ncurses: Fix ncurses not using dim because it is missing from the sgr property

View File

@@ -124,8 +124,8 @@ class Mappings:
from .fast_data_types import add_timer
self._cancel_mode_timeout()
self.mode_timeout_timer_id = add_timer(self._on_mode_timeout, mode.timeout, False)
mode.timeout_timer_id = self.mode_timeout_timer_id
self.mode_timeout_timer_id = mode.timeout_timer_id = add_timer(
self._on_mode_timeout, mode.timeout, False)
def _cancel_mode_timeout(self) -> None:
if self.mode_timeout_timer_id is not None:

View File

@@ -1359,20 +1359,18 @@ class KeyboardMode:
KeyboardModeMap = dict[str, KeyboardMode]
key_map_option_converters: defaultdict[str, Callable[[str], Any]] = defaultdict(lambda: (lambda x: x))
key_map_option_converters['timeout'] = float
def parse_options_for_map(val: str) -> tuple[KeyMapOptions, str]:
expecting_arg = ''
ans = KeyMapOptions()
key_map_option_converters: dict[str, Callable[[str], object]] = {
'timeout': float,
}
s = Shlex(val)
while (tok := s.next_word())[0] > -1:
x = tok[1]
if expecting_arg:
convert = key_map_option_converters.get(expecting_arg)
object.__setattr__(ans, expecting_arg, convert(x) if convert else x)
object.__setattr__(ans, expecting_arg, key_map_option_converters[expecting_arg](x))
expecting_arg = ''
elif x.startswith('--'):
expecting_arg = x[2:]
@@ -1382,8 +1380,7 @@ def parse_options_for_map(val: str) -> tuple[KeyMapOptions, str]:
if expecting_arg not in allowed_key_map_options:
raise KeyError(f'The map option {x} is unknown. Allowed options: {", ".join(allowed_key_map_options)}')
if sep == '=':
convert = key_map_option_converters.get(k)
object.__setattr__(ans, k, convert(v) if convert else v)
object.__setattr__(ans, k, key_map_option_converters[k](v))
expecting_arg = ''
else:
return ans, val[tok[0]:]