mirror of https://github.com/adamdruppe/arsd.git
asserts to prevent things from overflowing
This commit is contained in:
parent
b2aae8b83c
commit
49a63f04ef
|
@ -7607,7 +7607,9 @@ class TableView : Widget {
|
||||||
if(remaining < 0)
|
if(remaining < 0)
|
||||||
remaining = 0;
|
remaining = 0;
|
||||||
|
|
||||||
|
int percentTotal;
|
||||||
foreach(i, ref column; columns) {
|
foreach(i, ref column; columns) {
|
||||||
|
percentTotal += column.widthPercent;
|
||||||
auto c = column.width + (remaining * column.widthPercent) / 100;
|
auto c = column.width + (remaining * column.widthPercent) / 100;
|
||||||
column.calculatedWidth = c;
|
column.calculatedWidth = c;
|
||||||
version(win32_widgets)
|
version(win32_widgets)
|
||||||
|
@ -7615,6 +7617,10 @@ class TableView : Widget {
|
||||||
SendMessage(hwnd, LVM_SETCOLUMNWIDTH, i, c); // LVSCW_AUTOSIZE or LVSCW_AUTOSIZE_USEHEADER are amazing omg
|
SendMessage(hwnd, LVM_SETCOLUMNWIDTH, i, c); // LVSCW_AUTOSIZE or LVSCW_AUTOSIZE_USEHEADER are amazing omg
|
||||||
}
|
}
|
||||||
|
|
||||||
|
assert(percentTotal >= 0, "The total percents in your column definitions were negative. They must add up to something between 0 and 100.");
|
||||||
|
assert(percentTotal <= 100, "The total percents in your column definitions exceeded 100. They must add up to no more than 100 (can be less though).");
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override void registerMovement() {
|
override void registerMovement() {
|
||||||
|
|
Loading…
Reference in New Issue