Skip to content

textview: optimize linedisplay cache based on number of visible rows

Christian Hergert requested to merge wip/chergert/tune-linedisplay-cache into master

This tries to estimate the number of visible rows in a textview based on the default text size and then tunes the GtkTextLineDisplayCache to keep 3*n_rows entries in the cache.

This was found imperically to be near the right cache size. In most cases, this is less than the number of items we cache now. However, in some cases, such as the "overview map" from GtkSourceView, it allows us to reach a higher value such as 1000+. This is needed to keep scrolling smooth on the larger view sizes.

With this patch, a HiDPI system with a GtkSourceView and GtkSourceMap from the GTK 4 port can perform smooth scrolling simultaneously.

Merge request reports