fix: should not get the previous visual selection (#698)

This commit is contained in:
yetone 2024-10-09 17:16:01 +08:00 committed by GitHub
parent e78f5b28a5
commit 3dac407a11
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -168,6 +168,8 @@ end
---Get the selected content and range in Visual mode
---@return avante.SelectionResult | nil Selected content and range
function M.get_visual_selection_and_range()
if not M.in_visual_mode() then return nil end
local Range = require("avante.range")
local SelectionResult = require("avante.selection_result")
@ -175,11 +177,6 @@ function M.get_visual_selection_and_range()
local start_pos = fn.getpos("v")
local end_pos = fn.getpos(".")
if not M.in_visual_mode() then
start_pos = fn.getpos("'<")
end_pos = fn.getpos("'>")
end
-- Get the start and end line and column numbers
local start_line = start_pos[2]
local start_col = start_pos[3]