Show More
@@ -632,6 +632,13 b' class ConsoleWidget(Configurable, QtGui.QWidget):' | |||||
632 | if self._in_buffer(position): |
|
632 | if self._in_buffer(position): | |
633 | cursor.movePosition(QtGui.QTextCursor.EndOfLine, |
|
633 | cursor.movePosition(QtGui.QTextCursor.EndOfLine, | |
634 | QtGui.QTextCursor.KeepAnchor) |
|
634 | QtGui.QTextCursor.KeepAnchor) | |
|
635 | if not cursor.hasSelection(): | |||
|
636 | # Line deletion (remove continuation prompt) | |||
|
637 | cursor.movePosition(QtGui.QTextCursor.NextBlock, | |||
|
638 | QtGui.QTextCursor.KeepAnchor) | |||
|
639 | cursor.movePosition(QtGui.QTextCursor.Right, | |||
|
640 | QtGui.QTextCursor.KeepAnchor, | |||
|
641 | len(self._continuation_prompt)) | |||
635 | cursor.removeSelectedText() |
|
642 | cursor.removeSelectedText() | |
636 | intercepted = True |
|
643 | intercepted = True | |
637 |
|
644 | |||
@@ -702,17 +709,20 b' class ConsoleWidget(Configurable, QtGui.QWidget):' | |||||
702 | intercepted = not self._in_buffer(position - 1) |
|
709 | intercepted = not self._in_buffer(position - 1) | |
703 |
|
710 | |||
704 | elif key == QtCore.Qt.Key_Home: |
|
711 | elif key == QtCore.Qt.Key_Home: | |
705 | cursor.movePosition(QtGui.QTextCursor.StartOfBlock) |
|
|||
706 | start_line = cursor.blockNumber() |
|
712 | start_line = cursor.blockNumber() | |
707 | if start_line == self._get_prompt_cursor().blockNumber(): |
|
713 | if start_line == self._get_prompt_cursor().blockNumber(): | |
708 | start_pos = self._prompt_pos |
|
714 | start_pos = self._prompt_pos | |
709 | else: |
|
715 | else: | |
|
716 | cursor.movePosition(QtGui.QTextCursor.StartOfBlock, | |||
|
717 | QtGui.QTextCursor.KeepAnchor) | |||
710 | start_pos = cursor.position() |
|
718 | start_pos = cursor.position() | |
711 | start_pos += len(self._continuation_prompt) |
|
719 | start_pos += len(self._continuation_prompt) | |
|
720 | cursor.setPosition(position) | |||
712 | if shift_down and self._in_buffer(position): |
|
721 | if shift_down and self._in_buffer(position): | |
713 |
|
|
722 | cursor.setPosition(start_pos, QtGui.QTextCursor.KeepAnchor) | |
714 | else: |
|
723 | else: | |
715 |
|
|
724 | cursor.setPosition(start_pos) | |
|
725 | self._set_cursor(cursor) | |||
716 | intercepted = True |
|
726 | intercepted = True | |
717 |
|
727 | |||
718 | elif key == QtCore.Qt.Key_Backspace: |
|
728 | elif key == QtCore.Qt.Key_Backspace: | |
@@ -1184,18 +1194,6 b' class ConsoleWidget(Configurable, QtGui.QWidget):' | |||||
1184 | """ |
|
1194 | """ | |
1185 | self._control.setTextCursor(cursor) |
|
1195 | self._control.setTextCursor(cursor) | |
1186 |
|
1196 | |||
1187 | def _set_position(self, position): |
|
|||
1188 | """ Convenience method to set the position of the cursor. |
|
|||
1189 | """ |
|
|||
1190 | cursor = self._control.textCursor() |
|
|||
1191 | cursor.setPosition(position) |
|
|||
1192 | self._control.setTextCursor(cursor) |
|
|||
1193 |
|
||||
1194 | def _set_selection(self, start, end): |
|
|||
1195 | """ Convenience method to set the current selected text. |
|
|||
1196 | """ |
|
|||
1197 | self._control.setTextCursor(self._get_selection_cursor(start, end)) |
|
|||
1198 |
|
||||
1199 | def _show_context_menu(self, pos): |
|
1197 | def _show_context_menu(self, pos): | |
1200 | """ Shows a context menu at the given QPoint (in widget coordinates). |
|
1198 | """ Shows a context menu at the given QPoint (in widget coordinates). | |
1201 | """ |
|
1199 | """ |
General Comments 0
You need to be logged in to leave comments.
Login now