Skip to content

Commit

Permalink
fix qtconsole history logic for end-of-line
Browse files Browse the repository at this point in the history
EndOfLine may or may not mean the end of a full line when the line is longer than the window.
This commit uses the same logic to check as the actual move, so it should be consistent.

closes ipython#2943
  • Loading branch information
minrk committed Feb 16, 2013
1 parent 6181941 commit 7052404
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions IPython/frontend/qt/console/history_console_widget.py
Expand Up @@ -88,9 +88,15 @@ def _up_pressed(self, shift_modifier):
# to the line up to the cursor is if we are already
# in a simple scroll (no prefix),
# and the cursor is at the end of the first line
first_line = input_buffer.split('\n', 1)[0]

# check if we are at the end of the first line
c = self._get_prompt_cursor()
current_pos = c.position()
c.movePosition(QtGui.QTextCursor.EndOfLine)
at_eol = (c.position() == current_pos)

if self._history_index == len(self._history) or \
not (self._history_prefix == '' and col == len(first_line)) or \
not (self._history_prefix == '' and at_eol) or \
not (self._get_edited_history(self._history_index)[:col] == input_buffer[:col]):
self._history_prefix = input_buffer[:col]

Expand Down

0 comments on commit 7052404

Please sign in to comment.