Skip to content

Commit 8cea2b4

Browse files
committed
pyside6 fixes
1 parent cf02c13 commit 8cea2b4

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

CLAUDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Read AGENTS.md

PythonEditor/ui/features/search.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,14 +141,16 @@ def lookup(self, text, text_cursor):
141141
document = self.editor.document()
142142

143143
# avoid jumps by placing cursor at:
144-
start_pos = text_cursor.StartOfWord
144+
# PySide6 moved enums into QTextCursor.MoveOperation; PySide2 has them directly on QTextCursor
145+
_move_op = getattr(QtGui.QTextCursor, 'MoveOperation', QtGui.QTextCursor)
146+
start_pos = _move_op.StartOfWord
145147

146148
if (text_cursor.hasSelection()
147149
and text_cursor.selection(
148150
).toPlainText() == text):
149151

150152
# move on if word already matched
151-
start_pos = text_cursor.EndOfWord
153+
start_pos = _move_op.EndOfWord
152154

153155
text_cursor.movePosition(start_pos)
154156
cursor = document.find(

PythonEditor/ui/tabs.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -890,7 +890,8 @@ def set_editor_contents(self, index):
890890

891891
# set first block visible
892892
cursor = self.editor.textCursor()
893-
self.editor.moveCursor(cursor.End)
893+
_move_op = getattr(QTextCursor, 'MoveOperation', QTextCursor)
894+
self.editor.moveCursor(_move_op.End)
894895
cursor.setPosition(block_pos)
895896
self.editor.setTextCursor(cursor)
896897

0 commit comments

Comments
 (0)