Account for first removal char with wxELLIPSIZE_MIDDLE.

wxControl::Ellipsize() in wxELLIPSIZE_MIDDLE mode starts the
string-shortening loop with the removal interval initially set to remove
only the len/2-th character. But it didn't add its size to the running
total of removal characters' length, thus always removing one more
character. Fixed by making the initial interval 0-sized rather than
1-sized.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66823 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2011-01-31 18:23:32 +00:00
parent 3433de6e63
commit 4d3de2c5f7

View File

@@ -303,8 +303,8 @@ wxString wxControlBase::DoEllipsizeSingleLine(const wxString& curLine, const wxD
// - the second one to remove, valid range [initialCharToRemove;endCharToRemove]
// - the third one to preserve, valid range [endCharToRemove+1;len-1] or the empty range if endCharToRemove==len-1
// NOTE: empty range != range [0;0] since the range [0;0] contains 1 character (the zero-th one)!
initialCharToRemove = len/2;
size_t endCharToRemove = len/2; // index of the last character to remove; valid range is [0;len-1]
initialCharToRemove = len/2; // index of the last character to remove; valid range is [0;len-1]
size_t endCharToRemove = initialCharToRemove - 1; // initial removal range is empty
int removedPx = 0;
bool removeFromStart = true;