InputText: added experimental io.ConfigInputTextEnterKeepActive feature to make pressing Enter keep the input active and select all text.

This commit is contained in:
ocornut
2022-06-30 15:47:54 +02:00
parent 0afc6cd310
commit 609b935a8c
4 changed files with 16 additions and 2 deletions

View File

@ -4368,7 +4368,11 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
bool ctrl_enter_for_new_line = (flags & ImGuiInputTextFlags_CtrlEnterForNewLine) != 0;
if (!is_multiline || (ctrl_enter_for_new_line && !io.KeyCtrl) || (!ctrl_enter_for_new_line && io.KeyCtrl))
{
validated = clear_active_id = true;
validated = true;
if (io.ConfigInputTextEnterKeepActive && !is_multiline)
state->SelectAll(); // No need to scroll
else
clear_active_id = true;
}
else if (!is_readonly)
{