File tree Expand file tree Collapse file tree 4 files changed +6
-1
lines changed
Expand file tree Collapse file tree 4 files changed +6
-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
1011Bug Fixes:
1112----------
Original file line number Diff line number Diff line change @@ -78,6 +78,7 @@ Contributors:
7878 * bitkeen
7979 * Morgan Mitchell
8080 * Massimiliano Torromeo
81+ * Roland Walker
8182
8283Creator:
8384--------
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
@@ -548,7 +549,8 @@ def get_message():
548549 prompt = self .get_prompt (self .prompt_format )
549550 if self .prompt_format == self .default_prompt and len (prompt ) > self .max_len_prompt :
550551 prompt = self .get_prompt ('\\ d> ' )
551- return [('class:prompt' , prompt )]
552+ prompt = prompt .replace ("\\ x1b" , "\x1b " )
553+ return ANSI (prompt )
552554
553555 def get_continuation (width , * _ ):
554556 if self .multiline_continuation_char :
Original file line number Diff line number Diff line change @@ -65,6 +65,7 @@ wider_completion_menu = False
6565# \t - Product type (Percona, MySQL, MariaDB)
6666# \A - DSN alias name (from the [alias_dsn] section)
6767# \u - Username
68+ # \x1b[...m - insert ANSI escape sequence
6869prompt = ' \t \u @\h :\d > '
6970prompt_continuation = ' ->'
7071
You can’t perform that action at this time.
0 commit comments