textview: Invalidate selection when its style changes

This commit is contained in:
Alexander Mikhaylenko 2021-05-03 21:40:37 +05:00
parent f413d5ef22
commit 0fa4b7a249
3 changed files with 18 additions and 0 deletions

View File

@ -833,6 +833,20 @@ gtk_text_layout_invalidate_cursors (GtkTextLayout *layout,
gtk_text_layout_invalidated (layout); gtk_text_layout_invalidated (layout);
} }
void
gtk_text_layout_invalidate_selection (GtkTextLayout *layout)
{
GtkTextIter selection_start, selection_end;
g_return_if_fail (GTK_IS_TEXT_LAYOUT (layout));
if (layout->buffer &&
gtk_text_buffer_get_selection_bounds (layout->buffer,
&selection_start,
&selection_end))
gtk_text_layout_invalidate (layout, &selection_start, &selection_end);
}
void void
gtk_text_layout_free_line_data (GtkTextLayout *layout, gtk_text_layout_free_line_data (GtkTextLayout *layout,
GtkTextLine *line, GtkTextLine *line,

View File

@ -287,6 +287,7 @@ void gtk_text_layout_invalidate (GtkTextLayout *layout,
void gtk_text_layout_invalidate_cursors(GtkTextLayout *layout, void gtk_text_layout_invalidate_cursors(GtkTextLayout *layout,
const GtkTextIter *start, const GtkTextIter *start,
const GtkTextIter *end); const GtkTextIter *end);
void gtk_text_layout_invalidate_selection (GtkTextLayout *layout);
void gtk_text_layout_free_line_data (GtkTextLayout *layout, void gtk_text_layout_free_line_data (GtkTextLayout *layout,
GtkTextLine *line, GtkTextLine *line,
GtkTextLineData *line_data); GtkTextLineData *line_data);

View File

@ -5046,6 +5046,9 @@ gtk_text_view_state_flags_changed (GtkWidget *widget,
gtk_css_node_set_state (priv->selection_node, state); gtk_css_node_set_state (priv->selection_node, state);
if (priv->layout)
gtk_text_layout_invalidate_selection (priv->layout);
gtk_widget_queue_draw (widget); gtk_widget_queue_draw (widget);
} }