mirror of
https://github.com/wassname/pyreadline.git
synced 2026-10-02 12:40:27 +08:00
Fix of add_history bug #637506
This commit is contained in:
1 parent
bad7ebf0a3
commit
0361cee292
1 file changed
+4
@@ -99,12 +99,16 @@ class LineHistory(object):
|
||||
|
||||
def add_history(self, line):
|
||||
u'''Append a line to the history buffer, as if it was the last line typed.'''
|
||||
if not isinstance(line, lineobj.TextLine):
|
||||
line = lineobj.TextLine(line)
|
||||
|
||||
if not line.get_line_text():
|
||||
pass
|
||||
elif len(self.history) > 0 and self.history[-1].get_line_text() == line.get_line_text():
|
||||
pass
|
||||
else:
|
||||
self.history.append(line)
|
||||
|
||||
self.history_cursor = len(self.history)
|
||||
|
||||
def previous_history(self, current): # (C-p)
|
||||
|
||||
Reference in new issue
Block a user