Skip to content

Commit 8fbb11e

Browse files
convert tabs in rl_history entries to spaces
This will lead to duplicate history entries because the strings will no longer match, but it's an improvement
1 parent 970d3b9 commit 8fbb11e

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

bpython/curtsiesfrontend/repl.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -643,14 +643,16 @@ def yank_from_buffer(self):
643643

644644
def up_one_line(self):
645645
self.rl_history.enter(self.current_line)
646-
self._set_current_line(self.rl_history.back(False, search=self.config.curtsies_right_arrow_completion),
647-
reset_rl_history=False)
646+
self._set_current_line(tabs_to_spaces(self.rl_history.back(False,
647+
search=self.config.curtsies_right_arrow_completion)),
648+
reset_rl_history=False)
648649
self._set_cursor_offset(len(self.current_line), reset_rl_history=False)
649650

650651
def down_one_line(self):
651652
self.rl_history.enter(self.current_line)
652-
self._set_current_line(self.rl_history.forward(False, search=self.config.curtsies_right_arrow_completion),
653-
reset_rl_history=False)
653+
self._set_current_line(tabs_to_spaces(self.rl_history.forward(False,
654+
search=self.config.curtsies_right_arrow_completion)),
655+
reset_rl_history=False)
654656
self._set_cursor_offset(len(self.current_line), reset_rl_history=False)
655657

656658
def process_simple_keypress(self, e):
@@ -1369,6 +1371,9 @@ def key_help_text(self):
13691371
def is_nop(char):
13701372
return unicodedata.category(unicode(char)) == 'Cc'
13711373

1374+
def tabs_to_spaces(line):
1375+
return line.replace('\t', ' ')
1376+
13721377
def compress_paste_event(paste_event):
13731378
"""If all events in a paste event are identical and not simple characters, returns one of them
13741379

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy