From 0361cee29231f2c75a2db2e40a2dcaf8a0c3431c Mon Sep 17 00:00:00 2001 From: Jorgen Stenarson Date: Tue, 21 Sep 2010 18:19:43 +0200 Subject: [PATCH] Fix of add_history bug #637506 --- pyreadline/lineeditor/history.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pyreadline/lineeditor/history.py b/pyreadline/lineeditor/history.py index b4a0e84..0d42087 100644 --- a/pyreadline/lineeditor/history.py +++ b/pyreadline/lineeditor/history.py @@ -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)