From 1ca4e82b0435c7d65f65e535271f958a1021a5b2 Mon Sep 17 00:00:00 2001 From: cposture Date: Wed, 15 Nov 2023 23:08:30 +0800 Subject: fix selection include extra content when the user is in visual mode --- py/chat.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'py/chat.py') diff --git a/py/chat.py b/py/chat.py index 6d88015..907e71a 100644 --- a/py/chat.py +++ b/py/chat.py @@ -52,6 +52,7 @@ initial_messages = parse_chat_messages(initial_prompt) chat_content = vim.eval('trim(join(getline(1, "$"), "\n"))') chat_messages = parse_chat_messages(chat_content) +is_selection = vim.eval("l:is_selection") messages = initial_messages + chat_messages @@ -75,7 +76,7 @@ try: printDebug("[chat] response: {}", resp) return resp['choices'][0]['delta'].get('content', '') text_chunks = map(map_chunk, response) - render_text_chunks(text_chunks) + render_text_chunks(text_chunks, is_selection) vim.command("normal! a\n\n>>> user\n\n") vim.command("redraw") -- cgit v1.2.3