From 9c488bb877a4359b580397247807cb5d85659eef Mon Sep 17 00:00:00 2001 From: pagedown Date: Mon, 5 Dec 2022 14:27:40 +0800 Subject: [PATCH 1/2] Docs: Remove extra backslashes from commented config Update docs to use \e in the example. --- kitty/conf/types.py | 2 ++ kitty/options/definition.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/kitty/conf/types.py b/kitty/conf/types.py index f24046363..7f41a666e 100644 --- a/kitty/conf/types.py +++ b/kitty/conf/types.py @@ -113,6 +113,8 @@ def remove_markup(text: str) -> str: if key in ('ac', 'opt'): t, q = extract(m) return f'{t} {q}' if q and q != t else t + if key == 'code': + return m.group(2).replace('\\\\', '\\') return str(m.group(2)) diff --git a/kitty/options/definition.py b/kitty/options/definition.py index b7c56c922..1671650bf 100644 --- a/kitty/options/definition.py +++ b/kitty/options/definition.py @@ -3991,8 +3991,8 @@ keyboard protocol. The special value :code:`all` means all of them. Some more examples:: # Output a word and move the cursor to the start of the line (like typing and pressing Home) - map ctrl+alt+a send_text normal Word\\x1b[H - map ctrl+alt+a send_text application Word\\x1bOH + map ctrl+alt+a send_text normal Word\\e[H + map ctrl+alt+a send_text application Word\\eOH # Run a command at a shell prompt (like typing the command and pressing Enter) map ctrl+alt+a send_text normal,application some command with arguments\\r ''' From 30b25709d2d8a087adbc1719804a752da830348c Mon Sep 17 00:00:00 2001 From: pagedown Date: Mon, 5 Dec 2022 14:27:50 +0800 Subject: [PATCH 2/2] Fix the base path for envinclude --- kitty/conf/utils.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/kitty/conf/utils.py b/kitty/conf/utils.py index 993711a0c..bb75e4398 100644 --- a/kitty/conf/utils.py +++ b/kitty/conf/utils.py @@ -206,7 +206,12 @@ def parse_line( for x in os.environ: if fnmatchcase(x, val): with currently_parsing.set_file(f''): - _parse(NamedLineIterator(base_path_for_includes, iter(os.environ[x].splitlines())), parse_conf_item, ans, accumulate_bad_lines) + _parse( + NamedLineIterator(os.path.join(base_path_for_includes, ''), iter(os.environ[x].splitlines())), + parse_conf_item, + ans, + accumulate_bad_lines + ) return else: if not os.path.isabs(val): @@ -240,7 +245,7 @@ def _parse( ) -> None: name = getattr(lines, 'name', None) if name: - base_path_for_includes = os.path.dirname(os.path.abspath(name)) + base_path_for_includes = os.path.abspath(name) if name.endswith(os.path.sep) else os.path.dirname(os.path.abspath(name)) else: from ..constants import config_dir base_path_for_includes = config_dir