move cursor to start
move cursor to beginning of buffer if on the same line
@@ -2223,11 +2223,17 @@ class ConsoleWidget(MetaQObjectHasTraits('NewBase', (LoggingConfigurable, superQ
cursor = self._control.textCursor()
endpos = cursor.selectionEnd()
if endpos < self._prompt_pos:
+ cursor.setPosition(endpos)
+ line = cursor.blockNumber()
+ prompt_line = self._get_prompt_cursor().blockNumber()
+ if line == prompt_line:
+ # Cursor is on prompt line, move to start of buffer
+ cursor.setPosition(self._prompt_pos)
+ else:
# Cursor is not in buffer, move to the end
cursor.movePosition(QtGui.QTextCursor.End)
self._control.setTextCursor(cursor)
return True
-
startpos = cursor.selectionStart()
new_endpos = self._move_position_in_buffer(endpos)
