textview: Avoid misplacing the Emoji chooser

When the iter is at the end of the buffer,
gtk_text_view_get_iter_location returns a
rectangle with width 0, which in turn makes
gdk_rectangle_intersect return FALSE.

Avoid that by always giving the rectangle
non-empty dimensions.

Fixes: #4503
This commit is contained in:
Matthias Clasen 2021-11-30 19:44:26 -05:00
parent e0deacd236
commit b3b0321620

View File

@ -10012,6 +10012,10 @@ gtk_text_view_insert_emoji (GtkTextView *text_view)
gtk_text_buffer_get_insert (buffer));
gtk_text_view_get_iter_location (text_view, &iter, (GdkRectangle *) &rect);
rect.width = MAX (rect.width, 1);
rect.height = MAX (rect.height, 1);
gtk_text_view_buffer_to_window_coords (text_view, GTK_TEXT_WINDOW_TEXT,
rect.x, rect.y, &rect.x, &rect.y);
_text_window_to_widget_coords (text_view, &rect.x, &rect.y);