Skip to content

listviews: Reset scrollbar adjustment when list is empty

Corey Berla requested to merge coreyberla/gtk:empty_list_adjustment into main

In a list with a visible scrollbar, the scrollbar usually becomes invisible when the numbers of items is less than the required amount to scroll. If, however, the list is emptied all at once, the scrollbar remains. This happens because when there's an empty list gtk_list_view_size_allocate() returns early before the scrollbar adjustment is updated.

Given that the list is empty, simply reset the adjustment values to zero.

Easiest way to reproduce:

  1. Open the "Settings" demo
  2. Find a setting with a long enough list to make the scrollbar appear in the view on the right
  3. Paste in a phrase that has no matches (scrollbar will persist before this patch is applied)

Fixes: #4370 (closed)

Edited by Corey Berla

Merge request reports