From 0dfc35582157a9e0ff3ba2bf782746ceb2568ded Mon Sep 17 00:00:00 2001 From: Roland Walker Date: Mon, 27 Jul 2026 06:05:17 -0400 Subject: [PATCH] render tab literals as four spaces in the REPL rather than the "^I" control sequence. Learned from reading the pgcli source. --- changelog.md | 8 ++++++++ mycli/main_modes/repl.py | 10 ++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index dc859264..08e4440d 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,11 @@ +Upcoming (TBD) +============== + +Features +--------- +* Render tab literals as four spaces in the REPL. + + 2.7.0 (2026/07/25) ============== diff --git a/mycli/main_modes/repl.py b/mycli/main_modes/repl.py index 3f7b5581..0fcee418 100644 --- a/mycli/main_modes/repl.py +++ b/mycli/main_modes/repl.py @@ -33,7 +33,11 @@ to_plain_text, ) from prompt_toolkit.key_binding import KeyBindings -from prompt_toolkit.layout.processors import ConditionalProcessor, HighlightMatchingBracketProcessor +from prompt_toolkit.layout.processors import ( + ConditionalProcessor, + HighlightMatchingBracketProcessor, + TabsProcessor, +) from prompt_toolkit.lexers import PygmentsLexer from prompt_toolkit.output import ColorDepth from prompt_toolkit.shortcuts import CompleteStyle, PromptSession @@ -583,7 +587,9 @@ def _build_prompt_session( ConditionalProcessor( processor=HighlightMatchingBracketProcessor(chars='[](){}'), filter=has_focus(DEFAULT_BUFFER) & ~is_done, - ) + ), + # renders tab as four spaces rather than ^I control character + TabsProcessor(char1=' ', char2=' '), ], tempfile_suffix='.sql', completer=DynamicCompleter(lambda: mycli.completer),