This commit is contained in:
Kovid Goyal 2023-01-27 21:12:53 +05:30
commit e1c50cf124
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 3 additions and 3 deletions

View File

@ -329,13 +329,13 @@ def parse_marker_spec(ftype: str, parts: Sequence[str]) -> Tuple[str, Union[str,
if ftype.startswith('i'): if ftype.startswith('i'):
flags |= re.IGNORECASE flags |= re.IGNORECASE
if not parts or len(parts) % 2 != 0: 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 = [] ans = []
for i in range(0, len(parts), 2): for i in range(0, len(parts), 2):
try: try:
color = max(1, min(int(parts[i]), 3)) color = max(1, min(int(parts[i]), 3))
except Exception: 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] sspec = parts[i + 1]
if 'regex' not in ftype: if 'regex' not in ftype:
sspec = re.escape(sspec) sspec = re.escape(sspec)

View File

@ -29,7 +29,7 @@ class CreateMarker(RemoteCommand):
type=bool-set type=bool-set
Apply marker to the window this command is run in, rather than the active window. 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: def message_to_kitty(self, global_opts: RCOptions, opts: 'CLIOptions', args: ArgsType) -> PayloadType:
if len(args) < 2: if len(args) < 2: