Add other changes requested in comments for PR 1906

This commit is contained in:
New Pagodi
2020-06-25 21:41:33 -05:00
parent 0a6eea9bb5
commit a3a6938673

View File

@@ -2384,7 +2384,7 @@ private:
}; };
wxSTCListBoxVisualData::wxSTCListBoxVisualData(int d):m_desiredVisibleRows(d), wxSTCListBoxVisualData::wxSTCListBoxVisualData(int d):m_desiredVisibleRows(d),
m_imgAreaSize(0,0), m_useDefaultBgColour(true), m_useDefaultBgColour(true),
m_useDefaultTextColour(true), m_useDefaultTextColour(true),
m_useDefaultHighlightBgColour(true), m_useDefaultHighlightBgColour(true),
m_useDefaultHighlightTextColour(true), m_useDefaultHighlightTextColour(true),
@@ -3178,24 +3178,14 @@ public:
int curWidth = surface.WidthText(tempFont, buffer.data(), int curWidth = surface.WidthText(tempFont, buffer.data(),
wx2stclen(wxString(), buffer)); wx2stclen(wxString(), buffer));
if ( curWidth > rect.GetWidth() ) for ( int i = label.length(); curWidth > rect.GetWidth() && i; --i )
{ {
int len = label.Length(); ellipsizedLabel = label.Left(i);
ellipsizedLabel << "...";
for ( int i = len; i >= 0; --i ) buffer = wx2stc(ellipsizedLabel);
{ curWidth = surface.WidthText(tempFont, buffer.data(),
ellipsizedLabel = label.Left(i); wx2stclen(wxString(), buffer));
ellipsizedLabel << "...";
buffer = wx2stc(ellipsizedLabel);
curWidth = surface.WidthText(tempFont, buffer.data(),
wx2stclen(wxString(), buffer));
if ( curWidth <= rect.GetWidth() )
{
break;
}
}
} }
PRectangle prect = PRectangleFromwxRect(rect); PRectangle prect = PRectangleFromwxRect(rect);