Skip to content

Conversation

@guill
Copy link
Contributor

@guill guill commented Jan 30, 2026

The Dialog class was failing to clean up its keymaps (j, k, <Up>, <Down>, <CR>, <Esc>, 1-9) when torn down. This caused keymaps to accumulate on the output buffer, leaving it in an inconsistent state that could interfere with other keymaps including <C-c> for cancel and j/k for moving up and down.

Root cause: vim.keymap.set() returns true/nil, not a keymap identifier. The code was storing these useless return values and then trying to use them as key names in vim.keymap.del(), which silently failed.

Fix: Store the actual key binding strings (e.g., "j", "<CR>") instead of the return value, then use those strings to properly delete the keymaps during cleanup. Also added a buffer validity check to prevent errors when cleaning up after the buffer has been deleted.

The Dialog class was failing to clean up its keymaps (j, k, <Up>, <Down>,
<CR>, <Esc>, 1-9) when torn down. This caused keymaps to accumulate on
the output buffer, leaving it in an inconsistent state that could
interfere with other keymaps including <C-c> for cancel and j/k for
moving up and down.

Root cause: vim.keymap.set() returns true/nil, not a keymap identifier.
The code was storing these useless return values and then trying to use
them as key names in vim.keymap.del(), which silently failed.

Fix: Store the actual key binding strings (e.g., "j", "<CR>") instead of
the return value, then use those strings to properly delete the keymaps
during cleanup. Also added a buffer validity check to prevent errors
when cleaning up after the buffer has been deleted.
@sudo-tee
Copy link
Owner

Thanks for the fix.

@sudo-tee sudo-tee merged commit 2dba73d into sudo-tee:main Jan 30, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants