mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-05 20:48:46 +02:00
Merge branch 'master' into docking
# Conflicts: # examples/imgui_impl_glfw.cpp # examples/imgui_impl_sdl.cpp
This commit is contained in:
@ -3397,14 +3397,8 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
||||
bool enter_pressed = false;
|
||||
|
||||
// Select the buffer to render.
|
||||
const char* buf_display = ((render_cursor || render_selection || g.ActiveId == id) && !is_readonly && state && state->TextAIsValid) ? state->TextA.Data : buf;
|
||||
const char* buf_display_end = NULL; // We have specialized paths below for setting the length
|
||||
const bool is_displaying_hint = (hint != NULL && buf_display[0] == 0);
|
||||
if (is_displaying_hint)
|
||||
{
|
||||
buf_display = hint;
|
||||
buf_display_end = hint + strlen(hint);
|
||||
}
|
||||
const bool buf_display_from_state = (render_cursor || render_selection || g.ActiveId == id) && !is_readonly && state && state->TextAIsValid;
|
||||
const 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
|
||||
if (is_password && !is_displaying_hint)
|
||||
@ -3771,6 +3765,13 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
||||
// without any carriage return, which would makes ImFont::RenderText() reserve too many vertices and probably crash. Avoid it altogether.
|
||||
// Note that we only use this limit on single-line InputText(), so a pathologically large line on a InputTextMultiline() would still crash.
|
||||
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_end = NULL; // We have specialized paths below for setting the length
|
||||
if (is_displaying_hint)
|
||||
{
|
||||
buf_display = hint;
|
||||
buf_display_end = hint + strlen(hint);
|
||||
}
|
||||
|
||||
// Render text. We currently only render selection when the widget is active or while scrolling.
|
||||
// FIXME: We could remove the '&& render_cursor' to keep rendering selection when inactive.
|
||||
@ -5708,7 +5709,6 @@ void ImGui::Value(const char* prefix, float v, const char* float_format)
|
||||
// Helpers for internal use
|
||||
ImGuiMenuColumns::ImGuiMenuColumns()
|
||||
{
|
||||
Count = 0;
|
||||
Spacing = Width = NextWidth = 0.0f;
|
||||
memset(Pos, 0, sizeof(Pos));
|
||||
memset(NextWidths, 0, sizeof(NextWidths));
|
||||
@ -5716,12 +5716,12 @@ ImGuiMenuColumns::ImGuiMenuColumns()
|
||||
|
||||
void ImGuiMenuColumns::Update(int count, float spacing, bool clear)
|
||||
{
|
||||
IM_ASSERT(Count <= IM_ARRAYSIZE(Pos));
|
||||
Count = count;
|
||||
IM_ASSERT(count == IM_ARRAYSIZE(Pos));
|
||||
Width = NextWidth = 0.0f;
|
||||
Spacing = spacing;
|
||||
if (clear) memset(NextWidths, 0, sizeof(NextWidths));
|
||||
for (int i = 0; i < Count; i++)
|
||||
if (clear)
|
||||
memset(NextWidths, 0, sizeof(NextWidths));
|
||||
for (int i = 0; i < IM_ARRAYSIZE(Pos); i++)
|
||||
{
|
||||
if (i > 0 && NextWidths[i] > 0.0f)
|
||||
Width += Spacing;
|
||||
@ -5737,7 +5737,7 @@ float ImGuiMenuColumns::DeclColumns(float w0, float w1, float w2) // not using v
|
||||
NextWidths[0] = ImMax(NextWidths[0], w0);
|
||||
NextWidths[1] = ImMax(NextWidths[1], w1);
|
||||
NextWidths[2] = ImMax(NextWidths[2], w2);
|
||||
for (int i = 0; i < 3; i++)
|
||||
for (int i = 0; i < IM_ARRAYSIZE(Pos); i++)
|
||||
NextWidth += NextWidths[i] + ((i > 0 && NextWidths[i] > 0.0f) ? Spacing : 0.0f);
|
||||
return ImMax(Width, NextWidth);
|
||||
}
|
||||
|
Reference in New Issue
Block a user