diff --git a/interface/wx/control.h b/interface/wx/control.h index 3c77c72a9a..1f98daebe0 100644 --- a/interface/wx/control.h +++ b/interface/wx/control.h @@ -179,11 +179,11 @@ public: // static functions /** Replaces parts of the @a label string with ellipsis, if needed, so - that it doesn't exceed @a maxWidth. - - Note that this functions is guaranteed to always returns a string - whose rendering on the given DC takes less than @a maxWidth pixels - in horizontal. + that it fits into @a maxWidth pixels if possible. + + Note that this function does @em not guarantee that the returned string + will always be shorter than @a maxWidth; if @a maxWidth is extremely + small, ellipsized text may be larger. @param label The string to ellipsize diff --git a/src/common/ctrlcmn.cpp b/src/common/ctrlcmn.cpp index 444e0163e8..d08cb255dc 100755 --- a/src/common/ctrlcmn.cpp +++ b/src/common/ctrlcmn.cpp @@ -397,20 +397,7 @@ wxString wxControlBase::DoEllipsizeSingleLine(const wxString& curLine, const wxD wxString ret(curLine); ret.erase(initialCharToRemove, nCharsToRemove); - int removedPx; - if (initialCharToRemove >= 1) - removedPx = charOffsetsPx[initialCharToRemove+nCharsToRemove-1] - charOffsetsPx[initialCharToRemove-1]; - else - removedPx = charOffsetsPx[initialCharToRemove+nCharsToRemove-1]; - wxASSERT(removedPx >= excessPx); - - // if there is space for the replacement dots, add them - if ((int)totalWidthPx-removedPx+replacementWidthPx <= maxFinalWidthPx) - ret.insert(initialCharToRemove, wxELLIPSE_REPLACEMENT); - - // if everything was ok, we should have shortened this line - // enough to make it fit in maxFinalWidthPx: - wxASSERT(dc.GetTextExtent(ret).GetWidth() <= maxFinalWidthPx); + ret.insert(initialCharToRemove, wxELLIPSE_REPLACEMENT); return ret; }