|
@@ -4669,7 +4669,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
|
|
|
|
|
// Select the buffer to render.
|
|
// Select the buffer to render.
|
|
const bool buf_display_from_state = (render_cursor || render_selection || g.ActiveId == id) && !is_readonly && state;
|
|
const bool buf_display_from_state = (render_cursor || render_selection || g.ActiveId == id) && !is_readonly && state;
|
|
- const bool is_displaying_hint = (hint != NULL && (buf_display_from_state ? state->TextA.Data : buf)[0] == 0);
|
|
|
|
|
|
+ bool is_displaying_hint = (hint != NULL && (buf_display_from_state ? state->TextA.Data : buf)[0] == 0);
|
|
|
|
|
|
// Password pushes a temporary font with only a fallback glyph
|
|
// Password pushes a temporary font with only a fallback glyph
|
|
if (is_password && !is_displaying_hint)
|
|
if (is_password && !is_displaying_hint)
|
|
@@ -5151,6 +5151,18 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
|
const int buf_display_max_length = 2 * 1024 * 1024;
|
|
const int buf_display_max_length = 2 * 1024 * 1024;
|
|
const char* buf_display = buf_display_from_state ? state->TextA.Data : buf; //-V595
|
|
const char* buf_display = buf_display_from_state ? state->TextA.Data : buf; //-V595
|
|
const char* buf_display_end = NULL; // We have specialized paths below for setting the length
|
|
const char* buf_display_end = NULL; // We have specialized paths below for setting the length
|
|
|
|
+
|
|
|
|
+ // Display hint when contents is empty
|
|
|
|
+ // At this point we need to handle the possibility that a callback could have modified the underlying buffer (#8368)
|
|
|
|
+ const bool new_is_displaying_hint = (hint != NULL && (buf_display_from_state ? state->TextA.Data : buf)[0] == 0);
|
|
|
|
+ if (new_is_displaying_hint != is_displaying_hint)
|
|
|
|
+ {
|
|
|
|
+ if (is_password && !is_displaying_hint)
|
|
|
|
+ PopFont();
|
|
|
|
+ is_displaying_hint = new_is_displaying_hint;
|
|
|
|
+ if (is_password && !is_displaying_hint)
|
|
|
|
+ PushPasswordFont();
|
|
|
|
+ }
|
|
if (is_displaying_hint)
|
|
if (is_displaying_hint)
|
|
{
|
|
{
|
|
buf_display = hint;
|
|
buf_display = hint;
|