fix(ui): restore output views without normal commands#452
Conversation
|
Here's another way to avoid emit local function scroll_view(target)
local view = vim.fn.winsaveview()
view.topline = view.lnum - target + 1
vim.fn.winrestview(view)
end
vim.keymap.set('n', '<leader>zb', function()
scroll_view(vim.api.nvim_win_get_height(0))
end)
vim.keymap.set('n', '<leader>zz', function()
scroll_view(math.ceil(vim.api.nvim_win_get_height(0) / 2))
end)
vim.keymap.set('n', '<leader>zt', function()
scroll_view(1)
end) |
|
All of this if-else branch should be included if we want to suppressed ModeChanged. opencode.nvim/lua/opencode/ui/renderer/scroll.lua Lines 128 to 138 in af18aec Also there're many other call site not sure if all of them related. |
17aad80 to
f1526ca
Compare
|
Thanks, your suggestion is the right direction. I revised the PR to use This removes the Could you give the updated branch a try? @phanen |
|
yeah, I'm using this branch now. |
|
Other thing lgtm, I've been on this branch a day and didn't reproduce input switch issue. |
|
Thanks for the PR. I've tested and it seems pretty stable for me to. |

Summary
Remove Normal-mode view commands from automatic output view maintenance.
The previous fix in #427 tried to protect the IME-sensitive output auto-scroll path by suppressing focus-related window/buffer events around
normal! zb. With the view restore moved towinsaveview()/winrestview(), that wrapper no longer has a job.This patch removes the source instead:
normal! zb;normal! zt;eventignorewrapper is removed;WinEnter,WinLeave,BufEnter, orModeChanged.Other
normal!call sites are left unchanged because they are user navigation / picker / selection paths, not automatic output view maintenance.Tests
./run_tests.sh