diff --git a/doc/codecompanion.txt b/doc/codecompanion.txt index 67d198f52..28be51c07 100644 --- a/doc/codecompanion.txt +++ b/doc/codecompanion.txt @@ -1628,6 +1628,29 @@ configuration and can be changed via: }) < +The keymaps for accepting and rejecting the diff sit within the `inline` +configuration and can be changed via: + +>lua + require("codecompanion").setup({ + strategies = { + inline = { + keymaps = { + accept_change = { + modes = { n = "gda" }, -- gDiffAccept + }, + reject_change = { + modes = { n = "gdr" }, -- gDiffReject + }, + always_accept = { + modes = { n = "gdt" }, + }, + }, + }, + }, + }) +< + USER INTERFACE (UI) ~ @@ -2333,7 +2356,7 @@ The fastest way to copy an LLM’s code output is with `gy`. This will yank the nearest codeblock. -APPLYING AN LLM€�S EDITS TO A BUFFER OR FILE ~ +APPLYING AN LLM’S EDITS TO A BUFFER OR FILE ~ The |codecompanion-usage-chat-buffer-tools-files| tool, combined with the |codecompanion-usage-chat-buffer-variables.html-buffer| variable or @@ -3846,7 +3869,7 @@ OpenAI adapter. as a great reference to understand how they’re working with the output of the API -OPENAI€�S API OUTPUT +OPENAI’S API OUTPUT If we reference the OpenAI documentation diff --git a/lua/codecompanion/strategies/chat/ui/init.lua b/lua/codecompanion/strategies/chat/ui/init.lua index 8c9a3149d..12d622eba 100644 --- a/lua/codecompanion/strategies/chat/ui/init.lua +++ b/lua/codecompanion/strategies/chat/ui/init.lua @@ -301,7 +301,16 @@ function UI:render(context, messages, opts) end local trimempty = not (msg.role == "user" and msg.content == "") - for _, text in ipairs(vim.split(msg.content or "", "\n", { plain = true, trimempty = trimempty })) do + local display_content = msg.content or "" + -- For anthropic adapter, the tool output is in msg.content.content + if type(display_content) == "table" then + if type(msg.content.content) == "string" then + display_content = msg.content.content + else + display_content = "[Message Cannot Be Displayed]" + end + end + for _, text in ipairs(vim.split(display_content or "", "\n", { plain = true, trimempty = trimempty })) do table.insert(lines, text) end