Skip to content

Commit 2171375

Browse files
committed
InputText: clarified that callbacks cannot modify buffer when using the ReadOnly flag.
1 parent 9e7c0f9 commit 2171375

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

docs/CHANGELOG.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ Other Changes:
8787
- InputText: numerical fields automatically accept full-width characters (U+FF01..U+FF5E)
8888
by converting them to half-width (U+0021..U+007E).
8989
- InputText: added support for shift+click style selection. (#5619) [@procedural]
90+
- InputText: clarified that callbacks cannot modify buffer when using the ReadOnly flag.
9091
- IsItemHovered: Added ImGuiHoveredFlags_DelayNormal and ImGuiHoveredFlags_DelayShort flags,
9192
allowing to introduce a shared delay for tooltip idioms. The delays are respectively
9293
io.HoverDelayNormal (default to 0.30f) and io.HoverDelayFast (default to 0.10f). (#1485)

imgui_widgets.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4546,6 +4546,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
45464546
if (callback_data.SelectionEnd != utf8_selection_end || buf_dirty) { state->Stb.select_end = (callback_data.SelectionEnd == callback_data.SelectionStart) ? state->Stb.select_start : ImTextCountCharsFromUtf8(callback_data.Buf, callback_data.Buf + callback_data.SelectionEnd); }
45474547
if (buf_dirty)
45484548
{
4549+
IM_ASSERT((flags & ImGuiInputTextFlags_ReadOnly) == 0);
45494550
IM_ASSERT(callback_data.BufTextLen == (int)strlen(callback_data.Buf)); // You need to maintain BufTextLen if you change the text!
45504551
InputTextReconcileUndoStateAfterUserCallback(state, callback_data.Buf, callback_data.BufTextLen); // FIXME: Move the rest of this block inside function and rename to InputTextReconcileStateAfterUserCallback() ?
45514552
if (callback_data.BufTextLen > backup_current_text_length && is_resizable)

0 commit comments

Comments
 (0)