Skip to content

Commit 5d1c48d

Browse files
authored
Linux/FreeBSD/macOS: Column widths correct initially and on update (#1552)
Column width was updated before SlotListCtrl had the slots added, which caused the column width to be incorrect before the first time OnTimer ran to update it. Changing the order ensures the column width is correct on program launch. Also ensure that we do not autosize column to fit empty content.
1 parent 4e112df commit 5d1c48d

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/Main/Forms/MainFrame.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1687,7 +1687,6 @@ namespace VeraCrypt
16871687
}
16881688

16891689
VolumeInfoList protectionTriggeredVolumes;
1690-
SlotListCtrl->SetColumnWidth(0, wxLIST_AUTOSIZE);
16911690

16921691
// Update list
16931692
long prevItemIndex = -1;
@@ -1773,8 +1772,10 @@ namespace VeraCrypt
17731772
}
17741773
}
17751774

1776-
if (listChanged)
1775+
if (listChanged) {
1776+
SlotListCtrl->SetColumnWidth(0, wxLIST_AUTOSIZE);
17771777
OnListChanged();
1778+
}
17781779

17791780
foreach (shared_ptr <VolumeInfo> volume, protectionTriggeredVolumes)
17801781
OnHiddenVolumeProtectionTriggered (volume);

src/Main/GraphicUserInterface.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2072,8 +2072,12 @@ namespace VeraCrypt
20722072
{
20732073
item.SetText (field);
20742074
listCtrl->SetItem (item);
2075-
if (item.GetColumn() == 3 || item.GetColumn() == 4)
2075+
if ((item.GetColumn() == 3 || item.GetColumn() == 4) && !item.GetText().IsEmpty())
20762076
listCtrl->SetColumnWidth(item.GetColumn(), wxLIST_AUTOSIZE);
2077+
// SlotListCtrl headers do not automatically move with column widths changing on macOS
2078+
#ifdef TC_MACOSX
2079+
listCtrl->Update();
2080+
#endif
20772081
changed = true;
20782082
}
20792083
}

0 commit comments

Comments
 (0)