[studio] Make rename file accept input upon pressing Enter if text input is focused
All checks were successful
Build / build (push) Successful in 3m36s

This commit is contained in:
Gary Talent 2025-01-27 00:33:14 -06:00
parent 13f0bf57e4
commit 2286238abc

View File

@ -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();
}