Skip to content

fix: be more resilient when updating buffer text in the background #415

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

emmanueltouzery
Copy link
Contributor

it's possible to get E565 when updating the buffer due to other user activity (triggering the abolish.vim 'cr' shortcut can do that).

This is really relatively bizarre, but I can in fact reproduce this on-demand in my setup. The stack is...

Error detected while processing User Autocommands for "OverseerListUpdate":
Error executing lua callback: ...r/start/overseer.nvim/lua/overseer/task_list/sidebar.lua:419: E565: Not allowed to change text or change window
stack traceback:
[C]: in function 'nvim_buf_set_lines'
...r/start/overseer.nvim/lua/overseer/task_list/sidebar.lua:419: in function 'render'
...r/start/overseer.nvim/lua/overseer/task_list/sidebar.lua:92: in function <...r/start/overseer.nvim/lua/overseer/task_list/sidebar.lua:91>
[C]: in function 'nvim_exec_autocmds'
...cker/start/overseer.nvim/lua/overseer/task_list/init.lua:14: in function 'rerender'
...verseer.nvim/lua/overseer/component/display_duration.lua:34: in function ''
vim/_editor.lua: in function <vim/_editor.lua:0>

To reproduce this... I start a long-running overseer task, so the clock will continuously update in the sidebar. I open the sidebar so the clock is displayed. I go to my normal buffer (not overseer) and type cr in normal mode. This triggers an abolish.vim shortcut (the full shortcut would be crs for instance to coerce the text under the cursor to snake case mode, or crc to camel case for instance).

And that triggers the error in the overseer code that executes in the background. The pcall silences it, makes the update fail, but it'll succeed the next update.

Maybe there are other set_text calls to fix, but this is one that really occurs often and so is really easy to trigger.

This is probably not the "right" fix.. So I'll understand 100% if you reject the PR. I'm not going to find the time to attempt to reproduce this on a clean setup... So if that approach doesn't work for you and you can't think of a better one.. it's maybe better to drop it. Also I guess "abolish is to blame" is likely a good answer too. But putting it out there just in case...

it's possible to get E565 when updating the buffer due to other user
activity (triggering the abolish.vim 'cr' shortcut can do that).
@github-actions github-actions bot requested a review from stevearc April 11, 2025 20:02
emmanueltouzery added a commit to emmanueltouzery/nvim_config that referenced this pull request Apr 11, 2025
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.

1 participant