Skip to content

Commit

Permalink
Widgets: Prevent Chinese input method to block edit input area
Browse files Browse the repository at this point in the history
  • Loading branch information
ccordoba12 committed Dec 19, 2024
1 parent 47b3d77 commit ceb7edd
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions spyder/widgets/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -1539,6 +1539,28 @@ def mouseDoubleClickEvent(self, event):
elif isinstance(self, QTextEdit):
QTextEdit.mouseDoubleClickEvent(self, event)

def inputMethodQuery(self, query):
"""
Prevent Chinese input method to block edit input area.
Notes
-----
This was suggested by a user in spyder-ide/spyder#23313. So, it's not
tested by us.
"""
if query == Qt.ImInputItemClipRectangle:
cursor_rect = self.cursorRect()
margins = self.viewportMargins()
cursor_rect.moveTopLeft(
cursor_rect.topLeft() + QPoint(margins.left(), margins.top())
)
return cursor_rect

if isinstance(self, QPlainTextEdit):
QPlainTextEdit.inputMethodQuery(self, query)
elif isinstance(self, QTextEdit):
QTextEdit.inputMethodQuery(self, query)


class TracebackLinksMixin(object):
"""Mixin to make file names in tracebacks and anchors clickable."""
Expand Down

0 comments on commit ceb7edd

Please sign in to comment.