From 4d3de2c5f73181b71296a10de17b96d63b78268a Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Mon, 31 Jan 2011 18:23:32 +0000 Subject: [PATCH] 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 --- src/common/ctrlcmn.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/ctrlcmn.cpp b/src/common/ctrlcmn.cpp index 398de36712..c1b4fa67a7 100644 --- a/src/common/ctrlcmn.cpp +++ b/src/common/ctrlcmn.cpp @@ -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; -- 2.45.2