From 8638e42135913acfd195b13224d60a877349e628 Mon Sep 17 00:00:00 2001 From: pagedown Date: Fri, 27 Jan 2023 23:15:13 +0800 Subject: [PATCH 1/2] Revert "Fix #5937" This reverts commit 4b322560c398e704d402a0b46a19afad24e50bdd. Only two arguments are required to create a marker. --- kitty/rc/create_marker.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kitty/rc/create_marker.py b/kitty/rc/create_marker.py index 0abfcf1f5..4391c0ddb 100644 --- a/kitty/rc/create_marker.py +++ b/kitty/rc/create_marker.py @@ -29,7 +29,7 @@ class CreateMarker(RemoteCommand): type=bool-set Apply marker to the window this command is run in, rather than the active window. ''' - args = RemoteCommand.Args(spec='MARKER SPECIFICATION', json_field='marker_spec', minimum_count=3) + args = RemoteCommand.Args(spec='MARKER SPECIFICATION', json_field='marker_spec', minimum_count=2) def message_to_kitty(self, global_opts: RCOptions, opts: 'CLIOptions', args: ArgsType) -> PayloadType: if len(args) < 2: From aacb4db2dcc980424bbf3ada8da4bf0e89e25787 Mon Sep 17 00:00:00 2001 From: pagedown Date: Fri, 27 Jan 2023 23:31:06 +0800 Subject: [PATCH 2/2] Remote control: Improve create-marker error messages No more missing color errors when text/regex are missing. Use `mark group` in error messages instead of `color`. --- kitty/options/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kitty/options/utils.py b/kitty/options/utils.py index 4df2f1dff..50adaf0cc 100644 --- a/kitty/options/utils.py +++ b/kitty/options/utils.py @@ -329,13 +329,13 @@ def parse_marker_spec(ftype: str, parts: Sequence[str]) -> Tuple[str, Union[str, if ftype.startswith('i'): flags |= re.IGNORECASE if not parts or len(parts) % 2 != 0: - raise ValueError('No color specified in marker: {}'.format(' '.join(parts))) + raise ValueError('Mark group number and text/regex are not specified in pairs: {}'.format(' '.join(parts))) ans = [] for i in range(0, len(parts), 2): try: color = max(1, min(int(parts[i]), 3)) except Exception: - raise ValueError(f'color {parts[i]} in marker specification is not an integer') + raise ValueError(f'Mark group in marker specification is not an integer: {parts[i]}') sspec = parts[i + 1] if 'regex' not in ftype: sspec = re.escape(sspec)