File tree Expand file tree Collapse file tree 3 files changed +5
-1
lines changed Expand file tree Collapse file tree 3 files changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ Features:
66
77* Add an option ` --init-command ` to execute SQL after connecting (Thanks: [ KITAGAWA Yasutaka] ).
88* Use InputMode.REPLACE_SINGLE
9+ * Add support for ANSI escape sequences for coloring the prompt.
910* Allow customization of Pygments SQL syntax-highlighting styles.
1011* Add a ` \clip ` special command to copy queries to the system clipboard.
1112* Add a special command ` \pipe_once ` to pipe output to a subprocess.
Original file line number Diff line number Diff line change 2828from prompt_toolkit .shortcuts import PromptSession , CompleteStyle
2929from prompt_toolkit .document import Document
3030from prompt_toolkit .filters import HasFocus , IsDone
31+ from prompt_toolkit .formatted_text import ANSI
3132from prompt_toolkit .layout .processors import (HighlightMatchingBracketProcessor ,
3233 ConditionalProcessor )
3334from prompt_toolkit .lexers import PygmentsLexer
@@ -566,7 +567,8 @@ def get_message():
566567 prompt = self .get_prompt (self .prompt_format )
567568 if self .prompt_format == self .default_prompt and len (prompt ) > self .max_len_prompt :
568569 prompt = self .get_prompt ('\\ d> ' )
569- return [('class:prompt' , prompt )]
570+ prompt = prompt .replace ("\\ x1b" , "\x1b " )
571+ return ANSI (prompt )
570572
571573 def get_continuation (width , * _ ):
572574 if self .multiline_continuation_char == '' :
Original file line number Diff line number Diff line change @@ -66,6 +66,7 @@ wider_completion_menu = False
6666# \t - Product type (Percona, MySQL, MariaDB)
6767# \A - DSN alias name (from the [alias_dsn] section)
6868# \u - Username
69+ # \x1b[...m - insert ANSI escape sequence
6970prompt = ' \t \u @\h :\d > '
7071prompt_continuation = ' ->'
7172
You can’t perform that action at this time.
0 commit comments