Skip to content

Commit 4188293

Browse files
committed
Added history reset to add_str, bs and bs_word
1 parent 1918218 commit 4188293

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

bpython/cli.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ def make_colors(config):
247247
}
248248

249249
if platform.system() == 'Windows':
250-
c = dict(c.items() +
250+
c = dict(c.items() +
251251
[
252252
('K', 8),
253253
('R', 9),
@@ -317,6 +317,7 @@ def __init__(self, scr, interp, statusbar, config, idle=None):
317317
def addstr(self, s):
318318
"""Add a string to the current input line and figure out
319319
where it should go, depending on the cursor position."""
320+
self.rl_history.reset()
320321
if not self.cpos:
321322
self.s += s
322323
else:
@@ -337,6 +338,7 @@ def atbol(self):
337338
def bs(self, delete_tabs=True):
338339
"""Process a backspace"""
339340

341+
self.rl_history.reset()
340342
y, x = self.scr.getyx()
341343

342344
if not self.s:
@@ -365,6 +367,7 @@ def bs(self, delete_tabs=True):
365367
return n
366368

367369
def bs_word(self):
370+
self.rl_history.reset()
368371
pos = len(self.s) - self.cpos - 1
369372
deleted = []
370373
# First we delete any space to the left of the cursor.
@@ -815,7 +818,7 @@ def p_key(self, key):
815818
else:
816819
C_BACK = chr(8)
817820
BACKSP = chr(127)
818-
821+
819822
if key == C_BACK: # C-Backspace (on my computer anyway!)
820823
self.clrtobol()
821824
key = '\n'
@@ -966,7 +969,7 @@ def p_key(self, key):
966969
self.addstr(pad_keys[key])
967970
self.print_line(self.s)
968971
except KeyError:
969-
return ''
972+
return ''
970973
elif len(key) == 1 and not unicodedata.category(key) == 'Cc':
971974
self.addstr(key)
972975
self.print_line(self.s)

0 commit comments

Comments
 (0)