Skip to content

Commit fe77b7a

Browse files
committed
fix: clear chat selection marks and highlights on reset
When resetting the chat, properly clean up any remaining selection marks and highlights from the source buffer. This prevents leftover visual indicators from persisting after the chat session ends.
1 parent 149f7bf commit fe77b7a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lua/CopilotChat/init.lua

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -725,6 +725,14 @@ function M.stop(reset)
725725
state.chat:clear()
726726
state.last_prompt = nil
727727
state.last_response = nil
728+
729+
-- Clear the selection
730+
if state.source and utils.buf_valid(state.source.bufnr) then
731+
for _, mark in ipairs({ '<', '>', '[', ']' }) do
732+
pcall(vim.api.nvim_buf_del_mark, state.source.bufnr, mark)
733+
end
734+
highlight_selection(true, state.chat.config)
735+
end
728736
else
729737
client:stop()
730738
end

0 commit comments

Comments
 (0)