From 47b3d77d0bab2b7827112187f478b88e3914f0f1 Mon Sep 17 00:00:00 2001 From: Carlos Cordoba Date: Thu, 19 Dec 2024 10:53:44 -0500 Subject: [PATCH 1/2] IPython console: Make some block comments appear better in the Outline pane --- spyder/plugins/ipythonconsole/widgets/control.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/spyder/plugins/ipythonconsole/widgets/control.py b/spyder/plugins/ipythonconsole/widgets/control.py index b51d8c74e1f..ffa7b39f478 100644 --- a/spyder/plugins/ipythonconsole/widgets/control.py +++ b/spyder/plugins/ipythonconsole/widgets/control.py @@ -50,7 +50,8 @@ def __init__(self, parent=None): # To not use Spyder calltips obtained through the monitor self.calltips = False - # ---- Public methods ---------------------------------------------------- + # ---- Public methods + # ------------------------------------------------------------------------- def insert_horizontal_ruler(self): """ Insert a horizontal ruler with the appropriate color according @@ -69,7 +70,8 @@ def insert_horizontal_ruler(self): cursor.movePosition(cursor.End) cursor.insertFrame(ruler) - # ---- Private methods --------------------------------------------------- + # ---- Private methods + # ------------------------------------------------------------------------- def _key_paren_left(self, text): """ Action for '(' """ self.current_prompt_pos = self.parentWidget()._prompt_pos @@ -79,7 +81,8 @@ def _key_paren_left(self, text): self.show_object_info(last_obj) self.insert_text(text) - # ---- Qt methods -------------------------------------------------------- + # ---- Qt methods + # ------------------------------------------------------------------------- def showEvent(self, event): """Reimplement Qt Method""" self.sig_visibility_changed.emit(True) From ceb7edd5aae31bc53101ac6e1d57bfea92cde471 Mon Sep 17 00:00:00 2001 From: Carlos Cordoba Date: Thu, 19 Dec 2024 10:56:55 -0500 Subject: [PATCH 2/2] Widgets: Prevent Chinese input method to block edit input area --- spyder/widgets/mixins.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/spyder/widgets/mixins.py b/spyder/widgets/mixins.py index 5e32af56a93..e9c57232e0c 100644 --- a/spyder/widgets/mixins.py +++ b/spyder/widgets/mixins.py @@ -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."""