Daniel Brötzmann pushed to branch master at gajim / gajim
Commits:
ecf2eeca by wurstsalat at 2025-02-01T13:27:09+01:00
cfix: MessageInputTextView: Fix spelling suggestions for clicked word
Place the cursor at click position to trigger an update for spelling suggestions
- - - - -
1 changed file:
- gajim/gtk/message_input.py
Changes:
=====================================
gajim/gtk/message_input.py
=====================================
@@ -94,6 +94,10 @@ def __init__(self, parent: Gtk.Widget) -> None:
"completion-picked", self._on_completion_picked
)
+ gesture_secondary_click = Gtk.GestureClick(button=Gdk.BUTTON_SECONDARY)
+ gesture_secondary_click.connect("pressed", self._on_secondary_click)
+ self.add_controller(gesture_secondary_click)
+
focus_controller = Gtk.EventControllerFocus()
focus_controller.connect("enter", self._on_focus_enter)
focus_controller.connect("leave", self._on_focus_leave)
@@ -202,6 +206,21 @@ def _on_completion_picked(
buf.insert(start, complete_string)
self.grab_focus()
+ def _on_secondary_click(
+ self,
+ _gesture_click: Gtk.GestureClick,
+ _n_press: int,
+ x: float,
+ y: float,
+ ) -> int:
+ # Place the cursor at click position to trigger an update
+ # for spelling suggestions, see:
+ # https://gitlab.gnome.org/GNOME/libspelling/-/issues/5
+ _, iter_, _ = self.get_iter_at_position(int(x), int(y))
+ buf = self.get_buffer()
+ buf.place_cursor(iter_)
+ return Gdk.EVENT_PROPAGATE
+
def _on_focus_enter(self, _focus_controller: Gtk.EventControllerFocus) ->
None:
scrolled = self.get_parent()
assert scrolled
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/ecf2eecaa5d63233d2083f008576bfc27ee198c1
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/ecf2eecaa5d63233d2083f008576bfc27ee198c1
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]