This commit is contained in:
Kovid Goyal
2025-02-08 07:56:21 +05:30
parent c3ed945a93
commit af917e6bcc
2 changed files with 9 additions and 6 deletions

View File

@@ -118,6 +118,8 @@ Detailed list of changes
- macOS: Fix fallback font rendering for bold/italic text not working for some symbols that are present in the Menlo regular face but not the bold/italic faces (:iss:`8282`) - macOS: Fix fallback font rendering for bold/italic text not working for some symbols that are present in the Menlo regular face but not the bold/italic faces (:iss:`8282`)
- XTGETTCAP: Fix response invalid for empty string capabilities (:pull:`8304`)
0.39.1 [2025-02-01] 0.39.1 [2025-02-01]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@@ -4,7 +4,7 @@
import re import re
from binascii import hexlify, unhexlify from binascii import hexlify, unhexlify
from collections.abc import Generator from collections.abc import Generator
from typing import cast from typing import Literal, cast
from kitty.options.types import Options from kitty.options.types import Options
@@ -521,10 +521,11 @@ def key_as_bytes(name: str) -> bytes:
def get_capabilities(query_string: str, opts: 'Options', window_id: int = 0, os_window_id: int = 0) -> Generator[str, None, None]: def get_capabilities(query_string: str, opts: 'Options', window_id: int = 0, os_window_id: int = 0) -> Generator[str, None, None]:
from .fast_data_types import ERROR_PREFIX from .fast_data_types import ERROR_PREFIX
def result(encoded_query_name: str, x: str | None = None) -> str: def result(encoded_query_name: str, x: str | Literal[True] | None = None) -> str:
if not x: if x is None:
valid = 0 if x is None else 1 return f'0+r{encoded_query_name}'
return f'{valid}+r{encoded_query_name}' if x is True:
return f'1+r{encoded_query_name}'
return f'1+r{encoded_query_name}={hexlify(str(x).encode("utf-8")).decode("ascii")}' return f'1+r{encoded_query_name}={hexlify(str(x).encode("utf-8")).decode("ascii")}'
for encoded_query_name in query_string.split(';'): for encoded_query_name in query_string.split(';'):
@@ -543,7 +544,7 @@ def get_capabilities(query_string: str, opts: 'Options', window_id: int = 0, os_
yield result(encoded_query_name, rval) yield result(encoded_query_name, rval)
else: else:
if name in bool_capabilities: if name in bool_capabilities:
yield result(encoded_query_name, '') yield result(encoded_query_name, True)
continue continue
try: try:
val = queryable_capabilities[name] val = queryable_capabilities[name]