diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 197a97da4..1d37496b5 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -76,6 +76,8 @@ Other changes: - The feature is unlikely to ever work properly when using a coarse clipper such as ImGuiListClipper. - TreeNode: fixed incorrect clipping of arrow/bullet when using ImGuiTreeNodeFlags_SpanAllColumns. +- InputText: fixed cursor positioning issue using up/down keys near end of lines while + editing non-ASCII text. (Regression from 1.91.2) (#8635, #7925) - Tables: fixed TableHeader() eager vertical clipping of text which may be noticeable with FramePadding.y was too small. (#6236) - Tables: fixed an assert when combining Tables, Frozen Rows, Clipper and BeginMultiSelect() diff --git a/imgui.h b/imgui.h index b9b8bf6ad..633f9f6dc 100644 --- a/imgui.h +++ b/imgui.h @@ -29,7 +29,7 @@ // Library Version // (Integer encoded as XYYZZ for use in #if preprocessor conditionals, e.g. '#if IMGUI_VERSION_NUM >= 12345') #define IMGUI_VERSION "1.92.0 WIP" -#define IMGUI_VERSION_NUM 19194 +#define IMGUI_VERSION_NUM 19195 #define IMGUI_HAS_TABLE /* diff --git a/imstb_textedit.h b/imstb_textedit.h index b7a761c85..ecdc7d39d 100644 --- a/imstb_textedit.h +++ b/imstb_textedit.h @@ -918,7 +918,7 @@ retry: state->cursor = start; STB_TEXTEDIT_LAYOUTROW(&row, str, state->cursor); x = row.x0; - for (i=0; i < row.num_chars; ++i) { + for (i=0; i < row.num_chars; ) { float dx = STB_TEXTEDIT_GETWIDTH(str, start, i); #ifdef IMSTB_TEXTEDIT_GETWIDTH_NEWLINE if (dx == IMSTB_TEXTEDIT_GETWIDTH_NEWLINE) @@ -927,7 +927,9 @@ retry: x += dx; if (x > goal_x) break; - state->cursor = IMSTB_TEXTEDIT_GETNEXTCHARINDEX(str, state->cursor); + int next_cursor = IMSTB_TEXTEDIT_GETNEXTCHARINDEX(str, state->cursor); + i += next_cursor - state->cursor; + state->cursor = next_cursor; } stb_textedit_clamp(str, state); @@ -980,7 +982,7 @@ retry: state->cursor = find.prev_first; STB_TEXTEDIT_LAYOUTROW(&row, str, state->cursor); x = row.x0; - for (i=0; i < row.num_chars; ++i) { + for (i=0; i < row.num_chars; ) { float dx = STB_TEXTEDIT_GETWIDTH(str, find.prev_first, i); #ifdef IMSTB_TEXTEDIT_GETWIDTH_NEWLINE if (dx == IMSTB_TEXTEDIT_GETWIDTH_NEWLINE) @@ -989,7 +991,9 @@ retry: x += dx; if (x > goal_x) break; - state->cursor = IMSTB_TEXTEDIT_GETNEXTCHARINDEX(str, state->cursor); + int next_cursor = IMSTB_TEXTEDIT_GETNEXTCHARINDEX(str, state->cursor); + i += next_cursor - state->cursor; + state->cursor = next_cursor; } stb_textedit_clamp(str, state);