mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-10 12:40:10 +00:00
text: Fix handling of cursor invalidation
The GtkTextLineDisplayCache was sometimes losing track of the line containing the cursor, and then we end up snapshotting lines that have display_line->cursors_invalid set, which sadly means that we would not render any cursors. Fix that.
This commit is contained in:
parent
85b08355fb
commit
6edcaf1a43
@ -330,11 +330,14 @@ gtk_text_line_display_cache_get (GtkTextLineDisplayCache *cache,
|
||||
gboolean size_only)
|
||||
{
|
||||
GtkTextLineDisplay *display;
|
||||
GtkTextLine *cursor_line;
|
||||
|
||||
g_assert (cache != NULL);
|
||||
g_assert (layout != NULL);
|
||||
g_assert (line != NULL);
|
||||
|
||||
cursor_line = cache->cursor_line;
|
||||
|
||||
display = g_hash_table_lookup (cache->line_to_display, line);
|
||||
|
||||
if (display != NULL)
|
||||
@ -346,6 +349,9 @@ gtk_text_line_display_cache_get (GtkTextLineDisplayCache *cache,
|
||||
if (!size_only && display->line == cache->cursor_line)
|
||||
gtk_text_layout_update_display_cursors (layout, display->line, display);
|
||||
|
||||
if (!size_only && display->cursors_invalid)
|
||||
gtk_text_layout_update_display_cursors (layout, display->line, display);
|
||||
|
||||
if (!size_only && display->has_children)
|
||||
gtk_text_layout_update_children (layout, display);
|
||||
|
||||
@ -374,6 +380,11 @@ gtk_text_line_display_cache_get (GtkTextLineDisplayCache *cache,
|
||||
|
||||
if (!size_only)
|
||||
{
|
||||
/* Reestablish cache->cursor_line, in case it was cleared by
|
||||
* gtk_text_line_display_cache_invalidate_display() above.
|
||||
*/
|
||||
cache->cursor_line = cursor_line;
|
||||
|
||||
if (line == cache->cursor_line)
|
||||
gtk_text_layout_update_display_cursors (layout, line, display);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user