File tree Expand file tree Collapse file tree 3 files changed +7
-4
lines changed
Expand file tree Collapse file tree 3 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -334,6 +334,7 @@ class LiveProfiler(ThemeSection):
334334@dataclass (frozen = True , kw_only = True )
335335class Syntax (ThemeSection ):
336336 prompt : str = ANSIColors .BOLD_MAGENTA
337+ error : str = ANSIColors .BOLD_RED
337338 keyword : str = ANSIColors .BOLD_BLUE
338339 keyword_constant : str = ANSIColors .BOLD_BLUE
339340 builtin : str = ANSIColors .CYAN
Original file line number Diff line number Diff line change @@ -196,6 +196,7 @@ class Reader:
196196 ps3 : str = "|.. "
197197 ps4 : str = R"\__ "
198198 kill_ring : list [list [str ]] = field (default_factory = list )
199+ error_prefix : str = "! "
199200 msg : str = ""
200201 arg : int | None = None
201202 dirty : bool = False
@@ -641,7 +642,11 @@ def finish(self) -> None:
641642 pass
642643
643644 def error (self , msg : str = "none" ) -> None :
644- self .msg = "! " + msg + " "
645+ error_prefix = self .error_prefix
646+ if self .can_colorize :
647+ t = THEME ()
648+ error_prefix = f"{ t .error } { error_prefix } { t .reset } "
649+ self .msg = error_prefix + msg
645650 self .dirty = True
646651 self .console .beep ()
647652
Original file line number Diff line number Diff line change @@ -124,9 +124,6 @@ def __post_init__(self) -> None:
124124 self .commands ["backspace_dedent" ] = backspace_dedent
125125 self .commands ["backspace-dedent" ] = backspace_dedent
126126
127- def error (self , msg : str = "none" ) -> None :
128- pass # don't show error messages by default
129-
130127 def get_stem (self ) -> str :
131128 b = self .buffer
132129 p = self .pos - 1
You can’t perform that action at this time.
0 commit comments