Save column sizes before a rebuild

To prevent overriding the defaults, don't save sizes before
the initial build.

Save column sizes as floats rather than integers. This prevents
seeing a slight column resize after a rebuild.

Fixes #12943.
This commit is contained in:
Nick Hall 2023-08-07 18:20:19 +01:00
parent da027eb636
commit 8506a426d4
2 changed files with 3 additions and 1 deletions

View File

@ -328,6 +328,8 @@ class ListView(NavigationView):
self.uistate.viewmanager.tags.tag_disable() self.uistate.viewmanager.tags.tag_disable()
def build_tree(self, force_sidebar=False, preserve_col=True): def build_tree(self, force_sidebar=False, preserve_col=True):
if self.list.get_columns()[0].get_width() > 0:
self.list.save_column_info(self.list)
if self.active: if self.active:
cput0 = perf_counter() cput0 = perf_counter()
if not self.search_bar.is_visible(): if not self.search_bar.is_visible():

View File

@ -115,7 +115,7 @@ class PersistentTreeView(Gtk.TreeView):
# Don't resize the icons # Don't resize the icons
size = 2 size = 2
else: else:
size = int(column.get_width() / char_width) + 1 size = column.get_width() / char_width
size = 2 if size < 2 else size size = 2 if size < 2 else size
newsize.append(size) newsize.append(size)
nbc += 1 nbc += 1