ignore blank matches

This commit is contained in:
Will McGugan 2020-10-12 18:59:24 +01:00
parent fcbbf6902a
commit d17b7f5110
1 changed files with 2 additions and 2 deletions

View File

@ -413,13 +413,13 @@ class Text(JupyterMixin):
if style:
start, end = get_span()
match_style = style(plain[start:end]) if callable(style) else style
if match_style is not None and end - start:
if match_style is not None and end > start:
append_span(_Span(start, end, match_style))
count += 1
for name in match.groupdict().keys():
start, end = get_span(name)
if start != -1 and end - start:
if start != -1 and end > start:
append_span(_Span(start, end, f"{style_prefix}{name}"))
return count