jackMort / ChatGPT.nvim

ChatGPT Neovim Plugin: Effortless Natural Language Generation with OpenAI's ChatGPT API
Apache License 2.0
3.57k stars 307 forks source link

Buffer is not 'modifiable' error when submitting a new query while one is still executing. #340

Closed joeldrotleff closed 7 months ago

joeldrotleff commented 7 months ago

With the main ChatGPT window open, while a query is being executed, submitting a new query leads to an error being printed over and over:

Error executing vim.schedule lua callback: ...e/nvim/lazy/ChatGPT.nvim/lua/chatgpt/flows/chat/base.lua:263: Buffer is not 'modifiable'
stack traceback:
[C]: in function 'nvim_buf_set_lines'
...e/nvim/lazy/ChatGPT.nvim/lua/chatgpt/flows/chat/base.lua:263: in function 'addAnswerPartial'
...e/nvim/lazy/ChatGPT.nvim/lua/chatgpt/flows/chat/base.lua:723: in function ''
vim/_editor.lua: in function <vim/_editor.lua:0>

With (apparently) no good way to quit - :q, , C-c, C-d...nothing seems to work.

Steps to reproduce:

  1. Open ChatGPT plugin :ChatGPT
  2. Request something that takes a while to complete, i.e. "Tell me a story." Wait for response to begin streaming in.
  3. Type a new query, i.e. "Test" and hit Enter. Notice: Error is shown at bottom of screen, and can't be dismissed Expected: No error. I think a warning that says something like "You have a query running already. To cancel it, use C-x (the default cancel key command).
joeldrotleff commented 7 months ago

Here's a fix for it: https://github.com/jackMort/ChatGPT.nvim/pull/341