From 65d06610b51d502c7249965f0118635a96bebc7d 2010-12-16 11:12:30 From: Satrajit Ghosh Date: 2010-12-16 11:12:30 Subject: [PATCH] strip trailing \n for history lines --- diff --git a/IPython/core/history.py b/IPython/core/history.py index 65c85b4..318cabd 100644 --- a/IPython/core/history.py +++ b/IPython/core/history.py @@ -210,8 +210,8 @@ class HistoryManager(object): # do not store quit/exit commands if source_raw in ['Quit', 'quit', 'Exit', 'exit', '%Quit', '%quit', '%Exit', '%exit']: return - self.input_hist_parsed.append(source) - self.input_hist_raw.append(source_raw) + self.input_hist_parsed.append(source.rstrip()) + self.input_hist_raw.append(source_raw.rstrip()) self.shadow_hist.add(source) # update the auto _i variables diff --git a/IPython/frontend/qt/console/ipython_widget.py b/IPython/frontend/qt/console/ipython_widget.py index ea2df39..f879131 100644 --- a/IPython/frontend/qt/console/ipython_widget.py +++ b/IPython/frontend/qt/console/ipython_widget.py @@ -170,7 +170,7 @@ class IPythonWidget(FrontendWidget): input_history_dict = {} for key,val in history_dict.items(): input_history_dict[int(key)] = val - items = [ val for _, val in sorted(input_history_dict.items()) ] + items = [ val.rstrip() for _, val in sorted(input_history_dict.items()) ] self._set_history(items) def _handle_pyout(self, msg):