summaryrefslogtreecommitdiff
path: root/src/Fl_Text_Display.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/Fl_Text_Display.cxx')
-rw-r--r--src/Fl_Text_Display.cxx5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/Fl_Text_Display.cxx b/src/Fl_Text_Display.cxx
index 7f14623d6..9e0aacc2f 100644
--- a/src/Fl_Text_Display.cxx
+++ b/src/Fl_Text_Display.cxx
@@ -1,5 +1,5 @@
//
-// Copyright 2001-2022 by Bill Spitzak and others.
+// Copyright 2001-2026 by Bill Spitzak and others.
// Original code Copyright Mark Edel. Permission to distribute under
// the LGPL for the FLTK library granted by Mark Edel.
//
@@ -2263,7 +2263,8 @@ int Fl_Text_Display::find_x(const char *s, int len, int style, int x) const {
int i = 0;
int last_w = 0; // STR #2788
while (i<len) {
- int cl = fl_utf8len1(s[i]);
+ const char *next = fl_utf8_next_composed_char(s + i, s + len);
+ int cl = next - (s+i);
int w = int( string_width(s, i+cl, style) );
if (w>x) {
if (cursor_pos && (w-x < x-last_w)) return i+cl; // STR #2788