auto scroll to latest question

This commit is contained in:
Jonas Widen 2025-03-16 14:48:35 +01:00
parent acfa74de7b
commit 5497e10394

View File

@ -82,7 +82,11 @@ local function update_chat_window(new_content)
vim.api.nvim_buf_set_option(chat_bufnr, 'modifiable', false) vim.api.nvim_buf_set_option(chat_bufnr, 'modifiable', false)
-- Scroll to bottom -- Scroll to bottom
vim.api.nvim_win_set_cursor(chat_winnr, {vim.api.nvim_buf_line_count(chat_bufnr), 0}) local line_count = vim.api.nvim_buf_line_count(chat_bufnr)
vim.api.nvim_win_set_cursor(chat_winnr, {line_count, 0})
-- Ensure the last line is visible
vim.api.nvim_command('normal! zz')
-- Return focus to the previous window -- Return focus to the previous window
vim.cmd('wincmd p') vim.cmd('wincmd p')