From 2286238abc3f3176b4b052afce2331552d891859 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Mon, 27 Jan 2025 00:33:14 -0600 Subject: [PATCH] [studio] Make rename file accept input upon pressing Enter if text input is focused --- src/olympic/studio/applib/src/renamefile.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/olympic/studio/applib/src/renamefile.cpp b/src/olympic/studio/applib/src/renamefile.cpp index b4c633c7..24053fc4 100644 --- a/src/olympic/studio/applib/src/renamefile.cpp +++ b/src/olympic/studio/applib/src/renamefile.cpp @@ -50,8 +50,10 @@ void RenameFile::draw(StudioContext &ctx) noexcept { ImGui::SetKeyboardFocusHere(); } ig::InputText("Name", m_name); + auto const nameInputFocused = ImGui::IsItemFocused(); ImGui::Text("%s%s", m_path.c_str(), m_name.c_str()); - if (ig::PopupControlsOkCancel(m_open) == ig::PopupResponse::OK) { + if (ig::PopupControlsOkCancel(m_open) == ig::PopupResponse::OK || + (nameInputFocused && ImGui::IsKeyPressed(ImGuiKey_Enter))) { moveFile.emit(m_oldPath, m_path + m_name); close(); }