reapack

Package manager for REAPER
Log | Files | Refs | Submodules | README | LICENSE

commit 2ae7ea3a2d56aaf977c04a2c62c21490d288d5a8
parent 3952312eb70f648b03a75058cf83f4088c7a4853
Author: cfillion <cfillion@users.noreply.github.com>
Date:   Mon, 24 Feb 2020 16:32:25 -0500

listview: fix position of the first column missing from the serialized state

Diffstat:
Msrc/listview.cpp | 15++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/listview.cpp b/src/listview.cpp @@ -649,7 +649,7 @@ void ListView::restoreState(Serializer::Data &data) int col = -1; std::vector<int> order(columnCount()); - while(!data.empty()) { + while(col < columnCount() && !data.empty()) { const auto &[left, right] = data.front(); switch(col) { @@ -664,15 +664,16 @@ void ListView::restoreState(Serializer::Data &data) break; } - data.pop_front(); - - if(++col >= columnCount()) - break; + data.pop_front(); // deletes rec + ++col; } - // finish filling for other columns - for(col++; col < columnCount(); col++) + // fill default values for any columns whose state wasn't saved + // (col can't be -1 at this point, the loop above is always run at least once) + while(col < columnCount()) { order[col] = col; + ++col; + } ListView_SetColumnOrderArray(handle(), columnCount(), order.data()); }