diff options
author | Artur Balabanov <arturb@mustardsystems.com> | 2018-07-06 17:37:43 +0100 |
---|---|---|
committer | Artur Balabanov <arturb@mustardsystems.com> | 2018-07-06 17:37:43 +0100 |
commit | 87451b3806e04e8aa1df12c47ab26db7ac0bb606 (patch) | |
tree | 196e16e8af5ced0a6a398ec3016b742167fe794e | |
parent | d5b0b6527bb7d962de7a7494b8335008e15cf23d (diff) |
A new input processor has been added that renders tab characters as spaces instead of the ugly '^I'
-rw-r--r-- | pgcli/main.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/pgcli/main.py b/pgcli/main.py index 174cf688..6d4b1995 100644 --- a/pgcli/main.py +++ b/pgcli/main.py @@ -35,7 +35,8 @@ from prompt_toolkit.document import Document from prompt_toolkit.filters import Always, HasFocus, IsDone from prompt_toolkit.layout.lexers import PygmentsLexer from prompt_toolkit.layout.processors import (ConditionalProcessor, - HighlightMatchingBracketProcessor) + HighlightMatchingBracketProcessor, + TabsProcessor) from prompt_toolkit.history import FileHistory from prompt_toolkit.auto_suggest import AutoSuggestFromHistory from pygments.lexers.sql import PostgresLexer @@ -682,10 +683,12 @@ class PGCli(object): display_completions_in_columns=self.wider_completion_menu, multiline=True, extra_input_processors=[ - # Highlight matching brackets while editing. - ConditionalProcessor( - processor=HighlightMatchingBracketProcessor(chars='[](){}'), - filter=HasFocus(DEFAULT_BUFFER) & ~IsDone()), + # Highlight matching brackets while editing. + ConditionalProcessor( + processor=HighlightMatchingBracketProcessor(chars='[](){}'), + filter=HasFocus(DEFAULT_BUFFER) & ~IsDone()), + # Render \t as 4 spaces instead of "^I" + TabsProcessor(get_char1=lambda _: ' ', get_char2=lambda _: ' '), ]) with self._completer_lock: |