diff options
| author | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2026-01-24 16:15:47 +0100 |
|---|---|---|
| committer | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2026-01-24 16:15:47 +0100 |
| commit | bd4ad3e4a0c8e3153d9d3b532d9c572f5aaad897 (patch) | |
| tree | 96b18a5bc07c0ee93080676038aaf0d16f7705d9 /src/Fl_Text_Display.cxx | |
| parent | 84b562313216842764dd5b3f9825b3f232c45970 (diff) | |
Let Fl_Text_Editor and Fl_Input handle gracefully composed unicode characters.
Diffstat (limited to 'src/Fl_Text_Display.cxx')
| -rw-r--r-- | src/Fl_Text_Display.cxx | 5 |
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 |
