Skip to content

Commit f665867

Browse files
committed
1 parent 9e9165d commit f665867

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lua/gp/init.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1940,7 +1940,9 @@ M.Prompt = function(params, target, agent, template, prompt, whisper, callback)
19401940
-- mode specific logic
19411941
if target == M.Target.rewrite then
19421942
-- delete selection
1943-
vim.api.nvim_buf_set_lines(buf, start_line - 1, end_line - 1, false, {})
1943+
if not (start_line - 1 == 0 and end_line - 1 == 0 and vim.api.nvim_buf_get_lines(buf, 0, 1, false)[1] == "") then
1944+
vim.api.nvim_buf_set_lines(buf, start_line - 1, end_line - 1, false, {})
1945+
end
19441946
-- prepare handler
19451947
handler = M.dispatcher.create_handler(buf, win, start_line - 1, true, prefix, cursor)
19461948
elseif target == M.Target.append then

0 commit comments

Comments
 (0)