From 661bba09ce1fc815765d662fa982bc1d1d3f8c6e Mon Sep 17 00:00:00 2001 From: ocornut Date: Wed, 9 Oct 2024 13:54:39 +0200 Subject: [PATCH] InputText: fixed an issue with not declaring ownership of Delete/Backspace/Arrow keys. (#8048) --- docs/CHANGELOG.txt | 4 +++- docs/README.md | 2 +- imgui_widgets.cpp | 8 ++++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 32818837f..1af37fc5f 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -61,10 +61,12 @@ Other changes: ImGui_ImplXXXX_RenderDrawData() of standard backend to expose selected render state to draw callbacks. (#6969, #5834, #7468, #3590) - Tables: fixed initial auto-sizing issue with synched-instances. (#8045, #7218) +- InputText: fixed an issue with not declaring ownership of Delete/Backspace/Arrow keys, + preventing use of external shortcuts not guarded by an ActiveId check. (#8048) [@geertbleyen] - Backends: DX11, DX12, Vulkan, WGPU: expose selected state in ImGui_ImplXXXX_RenderState. structure during render loop. (#6969, #5834, #7468, #3590) - Backends: DX9, DX10, DX11, DX12, OpenGL, Vulkan, WGPU: Changed default texture sampler - to Clamp instead of Repeat/Wrap. (#7468, #7511, #5999, #5502) + to Clamp instead of Repeat/Wrap. (#7468, #7511, #5999, #5502, #7230) ----------------------------------------------------------------------- diff --git a/docs/README.md b/docs/README.md index 0968727f1..c47f03b9b 100644 --- a/docs/README.md +++ b/docs/README.md @@ -196,7 +196,7 @@ Ongoing Dear ImGui development is and has been financially supported by users an **THANK YOU to all past and present supporters for helping to keep this project alive and thriving!** Dear ImGui is using software and services provided free of charge for open source projects: -- [PVS-Studio](https://www.viva64.com/en/b/0570/) for static analysis. +- [PVS-Studio](https://pvs-studio.com/en/pvs-studio/?utm_source=website&utm_medium=github&utm_campaign=open_source) for static analysis (supports C/C++/C#/Java). - [GitHub actions](https://github.com/features/actions) for continuous integration systems. - [OpenCppCoverage](https://github.com/OpenCppCoverage/OpenCppCoverage) for code coverage analysis. diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index 156e7a813..4f6315879 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -4569,10 +4569,18 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_ if (user_clicked) SetKeyOwner(ImGuiKey_MouseLeft, id); g.ActiveIdUsingNavDirMask |= (1 << ImGuiDir_Left) | (1 << ImGuiDir_Right); + SetKeyOwner(ImGuiKey_LeftArrow, id); + SetKeyOwner(ImGuiKey_RightArrow, id); if (is_multiline || (flags & ImGuiInputTextFlags_CallbackHistory)) + { g.ActiveIdUsingNavDirMask |= (1 << ImGuiDir_Up) | (1 << ImGuiDir_Down); + SetKeyOwner(ImGuiKey_UpArrow, id); + SetKeyOwner(ImGuiKey_DownArrow, id); + } SetKeyOwner(ImGuiKey_Enter, id); SetKeyOwner(ImGuiKey_KeypadEnter, id); + SetKeyOwner(ImGuiKey_Delete, id); + SetKeyOwner(ImGuiKey_Backspace, id); SetKeyOwner(ImGuiKey_Home, id); SetKeyOwner(ImGuiKey_End, id); if (is_multiline)