mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-20 15:35:03 +02:00
A new option narrow_symbols to turn off opportunistic wide rendering of private use codepoints
This commit is contained in:
@@ -818,19 +818,19 @@ def action_alias(val: str) -> Iterable[Tuple[str, str]]:
|
||||
kitten_alias = action_alias
|
||||
|
||||
|
||||
def symbol_map(val: str) -> Iterable[Tuple[Tuple[int, int], str]]:
|
||||
def symbol_map(val: str, min_size: int = 2) -> Iterable[Tuple[Tuple[int, int], str]]:
|
||||
parts = val.split()
|
||||
|
||||
def abort() -> None:
|
||||
log_error(f'Symbol map: {val} is invalid, ignoring')
|
||||
|
||||
if len(parts) < 2:
|
||||
if len(parts) < min_size:
|
||||
return abort()
|
||||
family = ' '.join(parts[1:])
|
||||
|
||||
def to_chr(x: str) -> int:
|
||||
if not x.startswith('U+'):
|
||||
raise ValueError()
|
||||
raise ValueError(f'{x} is not a unicode codepoint of the form U+number')
|
||||
return int(x[2:], 16)
|
||||
|
||||
for x in parts[0].split(','):
|
||||
@@ -845,6 +845,11 @@ def symbol_map(val: str) -> Iterable[Tuple[Tuple[int, int], str]]:
|
||||
yield (a, b), family
|
||||
|
||||
|
||||
def narrow_symbols(val: str) -> Iterable[Tuple[Tuple[int, int], int]]:
|
||||
for x, y in symbol_map(val, min_size=1):
|
||||
yield x, int(y or 1)
|
||||
|
||||
|
||||
def parse_key_action(action: str, action_type: str = 'map') -> KeyAction:
|
||||
parts = action.strip().split(maxsplit=1)
|
||||
func = parts[0]
|
||||
|
||||
Reference in New Issue
Block a user