1
0
Fork 0

Merge pull request #903 from arturbalabanov/render-tabs-with-spaces

Fixes #346: Tab characters are rendered with spaces instead of "^I" when entered in external editor
This commit is contained in:
Irina Truong 2018-07-13 13:24:44 -07:00 committed by GitHub
commit 5491d288fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 5 deletions

View File

@ -82,6 +82,7 @@ Contributors:
* Matthieu Guilbert
* Alexandr Korsak
* Saif Hakim
* Artur Balabanov
Creator:

View File

@ -25,6 +25,7 @@ Bug Fixes:
* Fix ipython magic connection (#891). (Thanks: `Irina Truong`_)
* Fix not enough values to unpack. (Thanks: `Matthieu Guilbert`_)
* Fix unbound local error when destructive_warning is false. (Thanks: `Matthieu Guilbert`_)
* Render tab characters as 4 spaces instead of `^I`. (Thanks: `Artur Balabanov`_)
1.9.1:
======
@ -838,3 +839,4 @@ Improvements:
.. _`Matthieu Guilbert`: https://github.com/gma2th
.. _`Alexandr Korsak`: https://github.com/oivoodoo
.. _`Saif Hakim`: https://github.com/saifelse
.. _`Artur Balabanov`: https://github.com/arturbalabanov

View File

@ -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,14 @@ 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: