From cc9ded103c7380a1d8d719cbd30a9b87865f2da6 2011-11-15 22:52:22 From: Thomas Kluyver Date: 2011-11-15 22:52:22 Subject: [PATCH] Eliminate duplicate entries when filling readline-like history in the Qt console. --- diff --git a/IPython/frontend/qt/console/ipython_widget.py b/IPython/frontend/qt/console/ipython_widget.py index ea14490..ae183ab 100644 --- a/IPython/frontend/qt/console/ipython_widget.py +++ b/IPython/frontend/qt/console/ipython_widget.py @@ -197,7 +197,13 @@ class IPythonWidget(FrontendWidget): # reset retry flag self._retrying_history_request = False history_items = content['history'] - items = [ line.rstrip() for _, _, line in history_items ] + items = [] + last_cell = u"" + for _, _, cell in history_items: + cell = cell.rstrip() + if cell != last_cell: + items.append(cell) + last_cell = cell self._set_history(items) def _handle_pyout(self, msg):