Skip to content

Commit fcab22f

Browse files
committed
Fonts: fixed CalcWordWrapPositionA() fallback when width is too small to wrap with multibyte codepoints.. (#8540)
1 parent 8098d79 commit fcab22f

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

docs/CHANGELOG.txt

+2
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ Other changes:
5656
CTRL+Tab windowing + pressing a keyboard key. (#8525)
5757
- Error Handling: added better error report and recovery for extraneous
5858
EndPopup() call. (#1651, #8499)
59+
- Fonts: fixed CalcWordWrapPositionA() fallback when width is too small to wrap:
60+
would use a +1 offset instead of advancing to the next UTF-8 codepoint. (#8540)
5961
- Style, InputText: added ImGuiCol_InputTextCursor to configure color of
6062
the InputText cursor/caret. (#7031)
6163
- Misc: added extra operators to ImVec4 in IMGUI_DEFINE_MATH_OPERATORS block. (#8510) [@gan74]

imgui_draw.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -4027,7 +4027,7 @@ const char* ImFont::CalcWordWrapPositionA(float scale, const char* text, const c
40274027
// Wrap_width is too small to fit anything. Force displaying 1 character to minimize the height discontinuity.
40284028
// +1 may not be a character start point in UTF-8 but it's ok because caller loops use (text >= word_wrap_eol).
40294029
if (s == text && text < text_end)
4030-
return s + 1;
4030+
return s + ImTextCountUtf8BytesFromChar(s, text_end);
40314031
return s;
40324032
}
40334033

0 commit comments

Comments
 (0)