From 435c4d6ec62894c96e5abcb3c7514e7bede3b63b Mon Sep 17 00:00:00 2001 From: "K. Isom" Date: Tue, 17 Nov 2026 15:02:51 -0800 Subject: [PATCH] ImGui: arrow keys no longer scroll the view on their own With keyboard navigation enabled, ImGui scrolls a focused window that has no navigable items by itself on arrow keys (by a frame-time dependent pixel amount) and on PageUp/PageDown/Home/End. The text area is such a window once clicked, and the renderer copied that scroll into Rowoffs, so the view jumped a row or two on every arrow press on top of kte's own cursor movement. Set NoNavInputs on it. Co-Authored-By: Claude Opus 5.5 --- ImGuiRenderer.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ImGuiRenderer.cc b/ImGuiRenderer.cc index 4cd9cd4..d8c597c 100644 --- a/ImGuiRenderer.cc +++ b/ImGuiRenderer.cc @@ -102,8 +102,15 @@ ImGuiRenderer::Draw(Editor &ed) ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0, 0)); ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 0)); + // NoNavInputs: with keyboard navigation enabled, ImGui scrolls a + // focused window that has no navigable items by itself on arrow keys + // (by a frame-time-dependent pixel amount) and on PageUp/PageDown/ + // Home/End. kte already moves the cursor and scroll for those keys, + // and the sync above copied ImGui's extra scroll into Rowoffs, so the + // view jumped by a row or two on every arrow press. ImGui::BeginChild("scroll", ImVec2(0, child_h_plan), false, - ImGuiWindowFlags_HorizontalScrollbar | ImGuiWindowFlags_NoScrollWithMouse); + ImGuiWindowFlags_HorizontalScrollbar | ImGuiWindowFlags_NoScrollWithMouse + | ImGuiWindowFlags_NoNavInputs); // Get child window position and scroll for click handling ImVec2 child_window_pos = ImGui::GetWindowPos();