diff --git a/IPython/Extensions/clearcmd.py b/IPython/Extensions/clearcmd.py index afcc1f3..7fdd0e0 100644 --- a/IPython/Extensions/clearcmd.py +++ b/IPython/Extensions/clearcmd.py @@ -23,13 +23,15 @@ def clear_f(self,arg): elif target == 'in': print "Flushing input history" from IPython import iplib - del self.input_hist[:] - del self.input_hist_raw[:] - for n in range(1,self.outputcache.prompt_count + 1): + pc = self.outputcache.prompt_count + 1 + for n in range(1, pc): key = '_i'+`n` try: del self.user_ns[key] except: pass + # must be done in-place + self.input_hist[:] = ['\n'] * pc + self.input_hist_raw[:] = ['\n'] * pc elif target == 'array': try: pylab=ip.IP.pylab diff --git a/doc/ChangeLog b/doc/ChangeLog index 2342c92..8e881b8 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -10,7 +10,8 @@ * ipy_completers.py: quick_completer now makes it easy to create trivial custom completers - * clearcmd.py: shadow history compression & erasing + * clearcmd.py: shadow history compression & erasing, fixed input hist + clearing. * envpersist.py, history.py: %env (sh profile only), %hist completers