mirror of https://github.com/Textualize/rich.git
ignore blank matches
This commit is contained in:
parent
fcbbf6902a
commit
d17b7f5110
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue