gtk_text_view_scroll_to_mark() - potential implementation problem
I think gtk_text_view_scroll_to_mark()
is not well implemented.
gtk_text_view_flush_scroll()
is called in gtk_text_view_flush_first_validate()
, where the layout is often not fully validated.
The layout is fully validate inside incremental_validate_callback().
See the doc of gtk_text_view_scroll_to_iter() recommending to use gtk_text_view_scroll_to_mark(), where it explains the line heights computation in an idle.
gtk_text_view_flush_scroll() only calls gtk_text_layout_validate_yrange(), not a full validate.
So the fix might simply be to call gtk_text_view_flush_scroll() when we know that the layout is valid, and thus when the GtkTextView height is known. Otherwise the setup of the GtkAdjustments are wrong, I think.
Related to #5063
(for GTK 3 at least, probably also in GTK 4).