From 425a53d2fa5cc55aa7779de8e9466ae6f4763e79 Mon Sep 17 00:00:00 2001 From: Barrett Ruth <62671086+barrettruth@users.noreply.github.com> Date: Sun, 8 Mar 2026 16:02:09 -0400 Subject: [PATCH] fix(view): constrain cursor in insert mode (#93) Problem: `constrain_cursor` only fired on `CursorMoved` and `ModeChanged`, so arrow key navigation in insert mode could move the cursor into the concealed ID prefix area. Solution: add `CursorMovedI` to the autocmd event list. The `constrain_cursor()` function is already mode-agnostic. --- doc/upstream.md | 2 +- lua/canola/view.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/upstream.md b/doc/upstream.md index e0029dd..197aa76 100644 --- a/doc/upstream.md +++ b/doc/upstream.md @@ -64,7 +64,7 @@ issues against this fork. | [#360](https://github.com/stevearc/oil.nvim/issues/360) | Pick window to open file into | open | | [#362](https://github.com/stevearc/oil.nvim/issues/362) | "Could not find oil adapter for scheme" | not actionable — no repro, old nvim (0.9.5) | | [#363](https://github.com/stevearc/oil.nvim/issues/363) | `prompt_save_on_select_new_entry` wrong prompt | fixed | -| [#371](https://github.com/stevearc/oil.nvim/issues/371) | Constrain cursor in insert mode | open | +| [#371](https://github.com/stevearc/oil.nvim/issues/371) | Constrain cursor in insert mode | fixed ([#93](https://github.com/barrettruth/canola.nvim/pull/93)) | | [#373](https://github.com/stevearc/oil.nvim/issues/373) | Dir from quickfix with bqf/trouble broken | open | | [#375](https://github.com/stevearc/oil.nvim/issues/375) | Highlights for file types and permissions | open | | [#380](https://github.com/stevearc/oil.nvim/issues/380) | Silently overriding `show_hidden` | not actionable — counter to config intent | diff --git a/lua/canola/view.lua b/lua/canola/view.lua index 7a7ac89..e74ca17 100644 --- a/lua/canola/view.lua +++ b/lua/canola/view.lua @@ -552,7 +552,7 @@ M.initialize = function(bufnr) end end, }) - vim.api.nvim_create_autocmd({ 'CursorMoved', 'ModeChanged' }, { + vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI', 'ModeChanged' }, { desc = 'Update canola preview window', group = 'Canola', buffer = bufnr,