forked from qt-creator/qt-creator
Squish: use new approach for markText()
This new approach is a bit slower than using Qt functionality, but it's now completely relying on user-interaction. Change-Id: I361f6f201dfff8122a11aae30204eb79967fe4ae Reviewed-by: Robert Loehning <robert.loehning@digia.com>
This commit is contained in:
@@ -68,17 +68,12 @@ def openContextMenuOnTextCursorPosition(editor):
|
||||
waitFor("menuVisibleAtEditor(editor, menuInList)", 5000)
|
||||
return menuInList[0]
|
||||
|
||||
# this function marks/selects the text inside the given editor from position
|
||||
# startPosition to endPosition (both inclusive)
|
||||
def markText(editor, startPosition, endPosition):
|
||||
cursor = editor.textCursor()
|
||||
cursor.setPosition(startPosition)
|
||||
cursor.movePosition(QTextCursor.StartOfLine)
|
||||
editor.setTextCursor(cursor)
|
||||
cursor.movePosition(QTextCursor.Right, QTextCursor.KeepAnchor, endPosition-startPosition)
|
||||
cursor.movePosition(QTextCursor.EndOfLine, QTextCursor.KeepAnchor)
|
||||
cursor.setPosition(endPosition, QTextCursor.KeepAnchor)
|
||||
editor.setTextCursor(cursor)
|
||||
# this function marks/selects the text inside the given editor from current cursor position
|
||||
# param direction is one of "Left", "Right", "Up", "Down", but "End" and combinations work as well
|
||||
# param typeCount defines how often the cursor will be moved in the given direction (while marking)
|
||||
def markText(editor, direction, typeCount=1):
|
||||
for i in range(typeCount):
|
||||
type(editor, "<Shift+%s>" % direction)
|
||||
|
||||
# works for all standard editors
|
||||
def replaceEditorContent(editor, newcontent):
|
||||
|
||||
Reference in New Issue
Block a user