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 <noreply@anthropic.com>
This commit is contained in:
2026-11-17 15:02:51 -08:00
co-authored by Claude Opus 5.5
parent 4c8156ad9b
commit 435c4d6ec6
+8 -1
View File
@@ -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();