Fixed marks grouping and coloring for simultaneous multi marks definition

This commit is contained in:
Andrew Hlynskyi 2020-05-18 06:48:17 +03:00
parent e97454c4a5
commit 474bef65cb
2 changed files with 2 additions and 2 deletions

View File

@ -311,7 +311,7 @@ def parse_marker_spec(ftype: str, parts: Sequence[str]) -> Tuple[str, Union[str,
def toggle_marker(func: str, rest: str) -> FuncArgsType: def toggle_marker(func: str, rest: str) -> FuncArgsType:
parts = rest.split(maxsplit=1) parts = rest.split(maxsplit=1)
if len(parts) != 2: if len(parts) != 2:
raise ValueError('{} if not a valid marker specification'.format(rest)) raise ValueError('{} is not a valid marker specification'.format(rest))
ftype, spec = parts ftype, spec = parts
parts = spec.split() parts = spec.split()
return func, list(parse_marker_spec(ftype, parts)) return func, list(parse_marker_spec(ftype, parts))

View File

@ -56,7 +56,7 @@ def marker_from_multiple_regex(regexes: Iterable[Tuple[int, str]], flags: int =
for match in pat.finditer(text): for match in pat.finditer(text):
left.value = match.start() left.value = match.start()
right.value = match.end() - 1 right.value = match.end() - 1
grp = next(k for k, v in match.groupdict().items()) grp = match.lastgroup
color.value = color_map[grp] color.value = color_map[grp]
yield yield