Skip to content

Commit

Permalink
feat!: ChatNew now follows toggle_target option
Browse files Browse the repository at this point in the history
  • Loading branch information
frankroeder committed Sep 16, 2024
1 parent d34b637 commit 345fb4e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions lua/parrot/chat_handler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,9 @@ function ChatHandler:chat_new(params, chat_prompt)
return self:_new_chat(params, true, chat_prompt)
end

if params.args == "" then
params.args = self.options.toggle_target
end
return self:_new_chat(params, false, chat_prompt)
end

Expand Down
8 changes: 7 additions & 1 deletion lua/parrot/response_handler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,13 @@ function ResponseHandler:handle_chunk(qid, chunk)
self.first_line = vim.api.nvim_buf_get_extmark_by_id(self.buffer, self.ns_id, self.ex_id, {})[1]

local line_count = #vim.split(self.response, "\n")
vim.api.nvim_buf_set_lines(self.buffer, self.first_line + self.finished_lines, self.first_line + line_count, false, {})
vim.api.nvim_buf_set_lines(
self.buffer,
self.first_line + self.finished_lines,
self.first_line + line_count,
false,
{}
)

self:update_response(chunk)
self:update_buffer()
Expand Down

0 comments on commit 345fb4e

Please sign in to comment.