When the response is empty, the on_exit function indexes a nil value of the first_line (flc) (and the last_line (llc) is also a nil value)
Message:
Gp: OpenAI query response is empty:
""
Press ENTER or type command to continue
Error executing vim.schedule lua callback: ...kunzaatko/.local/share/nvim/lazy/gp.nvim/lua/gp/init.lua:2434: attempt to index local 'flc' (a nil
value)
stack traceback:
...kunzaatko/.local/share/nvim/lazy/gp.nvim/lua/gp/init.lua:2434: in function 'on_exit'
...kunzaatko/.local/share/nvim/lazy/gp.nvim/lua/gp/init.lua:2590: in function ''
vim/_editor.lua: in function <vim/_editor.lua:0>
Possible solution
The function can be returned from preemptively if the response is an empty string.
When the response is empty, the
on_exit
function indexes anil
value of thefirst_line
(flc
) (and thelast_line
(llc
) is also anil
value)Message:
Possible solution
The function can be
return
ed from preemptively if the response is an empty string.