File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -244,8 +244,13 @@ def get_line(lineno: int) -> list[tuple[str, str]]:
244244 line = document .lines [lineno ]
245245 tokens : list [tuple [str , str ]] = []
246246
247+ # No syntax highlighting if styles are disallowed
248+ if ru .ALLOW_STYLE == ru .AllowStyle .NEVER :
249+ tokens .append (('' , line ))
250+ return tokens
251+
247252 # Only attempt to match a command on the first line
248- if lineno == 0 and ru . ALLOW_STYLE != ru . AllowStyle . NEVER :
253+ if lineno == 0 :
249254 # Use cmd2's command pattern to find the first word (the command)
250255 match = self .cmd_app .statement_parser ._command_pattern .search (line )
251256 if match :
@@ -292,11 +297,8 @@ def get_line(lineno: int) -> list[tuple[str, str]]:
292297 # No command match found on the first line
293298 tokens .append (('' , line ))
294299 else :
295- # All other lines are unstyled or treated as arguments
296- if ru .ALLOW_STYLE != ru .AllowStyle .NEVER :
297- highlight_args (line , tokens )
298- else :
299- tokens .append (('' , line ))
300+ # All other lines are treated as arguments
301+ highlight_args (line , tokens )
300302
301303 return tokens
302304
You can’t perform that action at this time.
0 commit comments