Skip to content

Commit 6642dbf

Browse files
committed
feat: Move cursor to end of buffer before spinner start
The change ensures that the cursor is moved to the end of thebuffer before the spinner starts. This improves the user experience bymaking The change ensures that the cursor is moved to the end of thebuffer before the spinner starts. This improves the user experience bymaking sure the spinner always appears at the current end of the chat,regardless of where the cursor was previously.
1 parent 475d3fa commit 6642dbf

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

lua/CopilotChat/init.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,12 @@ function M.ask(prompt, config)
455455
temperature = config.temperature,
456456
on_start = function()
457457
append('\n\n **' .. config.name .. '** ' .. config.separator .. '\n\n')
458+
459+
-- Move the current to the end of the buffer before starting the spinner
460+
vim.api.nvim_win_set_cursor(
461+
state.window,
462+
{ vim.api.nvim_buf_line_count(state.chat.bufnr), 0 }
463+
)
458464
state.chat.spinner:start()
459465
end,
460466
on_done = function()

0 commit comments

Comments
 (0)