Pārlūkot izejas kodu

InputText: Fixed not returning true when buffer is cleared by ImGuiInputTextFlags_EscapeClearsAll. (#5688, #2620)

ocornut 2 gadi atpakaļ
vecāks
revīzija
94c46d7486
3 mainītis faili ar 3 papildinājumiem un 1 dzēšanām
  1. 1 0
      docs/CHANGELOG.txt
  2. 1 1
      imgui.h
  3. 1 0
      imgui_widgets.cpp

+ 1 - 0
docs/CHANGELOG.txt

@@ -67,6 +67,7 @@ Other changes:
 - IsWindowHovered, IsItemHovered: Assert when passed any unsupported flags.
 - Tables: Fixed a regression in 1.89.6 leading to the first column of tables with either
   ScrollX or ScrollY flags from being impossible to resize. (#6503)
+- InputText: Fixed not returning true when buffer is cleared by ImGuiInputTextFlags_EscapeClearsAll. (#5688, #2620)
 - Clipper: Rework inner logic to allow functioning with a zero-clear constructor.
   This is order to facilitate usage for language bindings (e.g cimgui or dear_binding)
   where user may not be callinga constructor manually. (#5856)

+ 1 - 1
imgui.h

@@ -23,7 +23,7 @@
 // Library Version
 // (Integer encoded as XYYZZ for use in #if preprocessor conditionals, e.g. '#if IMGUI_VERSION_NUM >= 12345')
 #define IMGUI_VERSION       "1.89.7 WIP"
-#define IMGUI_VERSION_NUM   18964
+#define IMGUI_VERSION_NUM   18965
 #define IMGUI_HAS_TABLE
 
 /*

+ 1 - 0
imgui_widgets.cpp

@@ -4573,6 +4573,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
                 // Clear input
                 apply_new_text = "";
                 apply_new_text_length = 0;
+                value_changed |= (buf[0] != 0);
                 STB_TEXTEDIT_CHARTYPE empty_string;
                 stb_textedit_replace(state, &state->Stb, &empty_string, 0);
             }