First, I tried using Gtk.GestureClick, but the Gtk.GestureClick “release” doesn’t fire when the mouse button is released at the end of the selection; it only fires after normal mouse clicks.
Then I tried using Gtk.GestureDrag, but the Gtk.GestureDrag “end” fires immediately after the first letter is selected and doesn’t fire again regardless of whether the selection continues. It also doesn’t fire when the mouse button is released at the end of the selection.
I also tried a “notify” connected to Gtk.TextView's “has-selection,” but it always fires as soon as the first letter is selected, just like Gtk.GestureDrag.
I’m really confused here, because Gtk.GestureDrag seems like the correct solution. Its purpose is to display a formatting bar that only appears when text is selected.