mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-16 15:14:17 +00:00
textview: Reset press counter if double/triple clicking on a different line
If we click close enough between lines, and with the maximum distances applied by GtkGestureClick we could jump between lines when handling double/triple click for word/line selection. Ensure that the whole operation stays in the same line and reset the gesture/counter if we do move between lines, so we start from scratch in the new line.
This commit is contained in:
parent
e9f7a9b8e6
commit
5b9a7863cf
@ -5640,6 +5640,26 @@ gtk_text_view_click_gesture_pressed (GtkGestureClick *gesture,
|
|||||||
if (state & GDK_SHIFT_MASK)
|
if (state & GDK_SHIFT_MASK)
|
||||||
extends = TRUE;
|
extends = TRUE;
|
||||||
|
|
||||||
|
if (n_press > 1)
|
||||||
|
{
|
||||||
|
GtkTextBuffer *buffer;
|
||||||
|
GtkTextIter cur, ins;
|
||||||
|
|
||||||
|
buffer = get_buffer (text_view);
|
||||||
|
get_iter_from_gesture (text_view, GTK_GESTURE (gesture),
|
||||||
|
&cur, NULL, NULL);
|
||||||
|
gtk_text_buffer_get_iter_at_mark (buffer, &ins,
|
||||||
|
gtk_text_buffer_get_insert (buffer));
|
||||||
|
|
||||||
|
/* Reset count if double/triple clicking on a different line */
|
||||||
|
if (gtk_text_iter_get_line (&cur) !=
|
||||||
|
gtk_text_iter_get_line (&ins))
|
||||||
|
{
|
||||||
|
gtk_event_controller_reset (GTK_EVENT_CONTROLLER (gesture));
|
||||||
|
n_press = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch (n_press)
|
switch (n_press)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
|
Loading…
Reference in New Issue
Block a user