Fix deleting columns in wxGridStringTable with custom column labels.

We erroneously removed too many elements from m_colLabels array (basically we
always removed all the elements remaining after this column, irrespectively of
the actual number of columns to delete), fix this by removing at most the
specified number of columns -- or possibly less if the array isn't entirely
filled.

See #13329.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68306 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2011-07-19 22:35:48 +00:00
parent 8c6b0819ec
commit d32fb5f9f4

View File

@@ -1534,9 +1534,8 @@ bool wxGridStringTable::DeleteCols( size_t pos, size_t numCols )
// m_colLabels stores just as many elements as it needs, e.g. if only
// the label of the first column had been set it would have only one
// element and not numCols, so account for it
int nToRm = m_colLabels.size() - colID;
if ( nToRm > 0 )
m_colLabels.RemoveAt( colID, nToRm );
int numRemaining = m_colLabels.size() - colID;
m_colLabels.RemoveAt( colID, wxMin(numCols, numRemaining) );
}
if ( numCols >= curNumCols )