Skip to content

Commit

Permalink
Improve AutoWrappingText trimming
Browse files Browse the repository at this point in the history
  • Loading branch information
vslavik committed Apr 4, 2024
1 parent de0bca0 commit 24eb482
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/customcontrols.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,10 @@ wxString WrapTextAtWidth(const wxString& text_, int width, Language lang, wxWind

for (int32_t pos = iter->begin(); pos != iter->end(); pos = iter->next())
{
if (pos == lineStart)
continue;
auto substr = str::to_wx(text + lineStart, pos - lineStart);
substr.Trim();

if (wnd->GetTextExtent(substr).x > width)
{
Expand Down Expand Up @@ -140,8 +143,7 @@ wxString WrapTextAtWidth(const wxString& text_, int width, Language lang, wxWind
out += previousSubstr;
}

if (out.Last() == '\n')
out.RemoveLast();
out.Trim();

return out;
}
Expand Down

0 comments on commit 24eb482

Please sign in to comment.