fix: should not get the previous visual selection (#698)
This commit is contained in:
parent
e78f5b28a5
commit
3dac407a11
@ -168,6 +168,8 @@ end
|
|||||||
---Get the selected content and range in Visual mode
|
---Get the selected content and range in Visual mode
|
||||||
---@return avante.SelectionResult | nil Selected content and range
|
---@return avante.SelectionResult | nil Selected content and range
|
||||||
function M.get_visual_selection_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 Range = require("avante.range")
|
||||||
local SelectionResult = require("avante.selection_result")
|
local SelectionResult = require("avante.selection_result")
|
||||||
|
|
||||||
@ -175,11 +177,6 @@ function M.get_visual_selection_and_range()
|
|||||||
local start_pos = fn.getpos("v")
|
local start_pos = fn.getpos("v")
|
||||||
local end_pos = fn.getpos(".")
|
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
|
-- Get the start and end line and column numbers
|
||||||
local start_line = start_pos[2]
|
local start_line = start_pos[2]
|
||||||
local start_col = start_pos[3]
|
local start_col = start_pos[3]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user