From 0e7f800395181bc599672d5476b6e2ec00d332cb 2007-08-22 18:01:09 From: vivainio Date: 2007-08-22 18:01:09 Subject: [PATCH] move empty line padding to before append of current line --- diff --git a/IPython/Logger.py b/IPython/Logger.py index 9b197c6..6f4880d 100644 --- a/IPython/Logger.py +++ b/IPython/Logger.py @@ -2,7 +2,7 @@ """ Logger class for IPython's logging facilities. -$Id: Logger.py 1336 2006-05-30 06:09:15Z fperez $ +$Id: Logger.py 2653 2007-08-22 18:01:09Z vivainio $ """ #***************************************************************************** @@ -196,6 +196,13 @@ which already exists. But you must first start the logging process with print 'userns:',self.shell.user_ns.keys() return + out_cache = self.shell.outputcache + + # add blank lines if the input cache fell out of sync. + if out_cache.do_full_cache and \ + out_cache.prompt_count +1 > len(input_hist): + input_hist.extend(['\n'] * (out_cache.prompt_count - len(input_hist))) + if not continuation and line_mod: self._iii = self._ii self._ii = self._i @@ -210,11 +217,7 @@ which already exists. But you must first start the logging process with to_main = {'_i':self._i,'_ii':self._ii,'_iii':self._iii} if self.shell.outputcache.do_full_cache: in_num = self.shell.outputcache.prompt_count - # add blank lines if the input cache fell out of sync. This can - # happen for embedded instances which get killed via C-D and then - # get resumed. - while in_num >= len(input_hist): - input_hist.append('\n') + # but if the opposite is true (a macro can produce multiple inputs # with no output display called), then bring the output counter in # sync: diff --git a/doc/ChangeLog b/doc/ChangeLog index bddd7e2..9e1e3c5 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -2,6 +2,10 @@ * iplib.py: no extra empty (last) line in raw hist w/ multiline statements + + * logger.py: Fix bug where blank lines in history were not + added until AFTER adding the current line; translated and raw + history should finally be in sync with prompt now. 2007-08-21 Ville Vainio