Skip to content

Commit

Permalink
Merge pull request #110 from nisseg/feature/home
Browse files Browse the repository at this point in the history
Home key event updated.
  • Loading branch information
minrk committed Mar 27, 2016
2 parents 513d739 + 657af86 commit 4fafcd9
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions qtconsole/console_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -1379,7 +1379,18 @@ def _event_filter_console_keypress(self, event):
start_pos = cursor.position()
start_pos += len(self._continuation_prompt)
cursor.setPosition(position)

c = self._get_cursor()
spaces = self._get_leading_spaces()
if (c.position() > start_pos + spaces or
c.columnNumber() == len(self._continuation_prompt)):
start_pos += spaces # Beginning of text

if shift_down and self._in_buffer(position):
if c.selectedText():
sel_max = max(c.selectionStart(), c.selectionEnd())
cursor.setPosition(sel_max,
QtGui.QTextCursor.MoveAnchor)
cursor.setPosition(start_pos, QtGui.QTextCursor.KeepAnchor)
else:
cursor.setPosition(start_pos)
Expand Down

0 comments on commit 4fafcd9

Please sign in to comment.