From 827ff970cd0feaa7d71a90e9ce10359207042094 Mon Sep 17 00:00:00 2001 From: ocornut Date: Fri, 10 Jul 2015 18:47:55 -0600 Subject: [PATCH] InputText: Added ImGuiInputTextFlags_AlwaysInsertMode flag --- imgui.cpp | 2 ++ imgui.h | 1 + 2 files changed, 3 insertions(+) diff --git a/imgui.cpp b/imgui.cpp index 6034d1fc5..e660048b3 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -7120,6 +7120,8 @@ static bool InputTextEx(const char* label, char* buf, int buf_size, const ImVec2 edit_state.StbState.select_start = ImMin(edit_state.StbState.select_start, edit_state.CurLenW); edit_state.StbState.select_end = ImMin(edit_state.StbState.select_end, edit_state.CurLenW); } + if (flags & ImGuiInputTextFlags_AlwaysInsertMode) + edit_state.StbState.insert_mode = true; if (!is_multiline && (focus_requested_by_tab || (user_clicked && is_ctrl_down))) select_all = true; } diff --git a/imgui.h b/imgui.h index f174841b6..a01923381 100644 --- a/imgui.h +++ b/imgui.h @@ -462,6 +462,7 @@ enum ImGuiInputTextFlags_ ImGuiInputTextFlags_AllowTabInput = 1 << 10, // Pressing TAB input a '\t' character into the text field ImGuiInputTextFlags_CtrlEnterForNewLine = 1 << 11, // In multi-line mode, allow exiting edition by pressing Enter. Ctrl+Enter to add new line (by default adds new lines with Enter). ImGuiInputTextFlags_NoHorizontalScroll = 1 << 12, // Disable following the cursor horizontally + ImGuiInputTextFlags_AlwaysInsertMode = 1 << 13, // Insert mode // [Internal] ImGuiInputTextFlags_Multiline = 1 << 20 // For internal use by InputTextMultiline() };