Skip to content

Commit

Permalink
fix: should not get the previous visual selection (yetone#698)
Browse files Browse the repository at this point in the history
  • Loading branch information
yetone authored Oct 9, 2024
1 parent e78f5b2 commit 3dac407
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions lua/avante/utils/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -168,18 +168,15 @@ 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")

-- Get the start and end positions of Visual mode
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]
Expand Down

0 comments on commit 3dac407

Please sign in to comment.