Skip to content

Commit

Permalink
clarify variable names
Browse files Browse the repository at this point in the history
  • Loading branch information
juliantaylor committed Oct 16, 2011
1 parent 8f24302 commit 7d6edcb
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions IPython/frontend/terminal/interactiveshell.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,11 +229,11 @@ def mainloop(self, display_banner=None):
# handling seems rather unpredictable...
self.write("\nKeyboardInterrupt in interact()\n")

def _store_multiline_history(self, source_raw, orig_hlen):
def _replace_rlhist_multiline(self, source_raw, hlen_before_cell):
"""Store multiple lines as a single entry in history"""
if self.multiline_history and self.has_readline:
hlen = self.readline.get_current_history_length()
for i in range(hlen - orig_hlen):
for i in range(hlen - hlen_before_cell):
self.readline.remove_history_item(hlen - i - 1)
self.readline.add_history(source_raw.rstrip())

Expand All @@ -253,7 +253,7 @@ def interact(self, display_banner=None):
self.show_banner()

more = False
hlen = self.readline.get_current_history_length()
hlen_before_cell = self.readline.get_current_history_length()

# Mark activity in the builtins
__builtin__.__dict__['__IPYTHON__active'] += 1
Expand Down Expand Up @@ -291,8 +291,8 @@ def interact(self, display_banner=None):
try:
self.write('\nKeyboardInterrupt\n')
source_raw = self.input_splitter.source_raw_reset()[1]
self._store_multiline_history(source_raw, hlen)
hlen = self.readline.get_current_history_length()
self._replace_rlhist_multiline(source_raw, hlen_before_cell)
hlen_before_cell = self.readline.get_current_history_length()
more = False
except KeyboardInterrupt:
pass
Expand Down Expand Up @@ -320,8 +320,8 @@ def interact(self, display_banner=None):
self.edit_syntax_error()
if not more:
source_raw = self.input_splitter.source_raw_reset()[1]
self._store_multiline_history(source_raw, hlen)
hlen = self.readline.get_current_history_length()
self._replace_rlhist_multiline(source_raw, hlen_before_cell)
hlen_before_cell = self.readline.get_current_history_length()
self.run_cell(source_raw, store_history=True)

# We are off again...
Expand Down

0 comments on commit 7d6edcb

Please sign in to comment.