Skip to content

Commit

Permalink
[Chore] remove unused comments (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
mistricky authored Feb 23, 2024
1 parent 0a8ec5b commit 1a46426
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions lua/codesnap/utils/visual.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,18 @@ function visual_utils.get_selected_text()
if start_pos[2] == end_pos[2] then
return vim.api.nvim_buf_get_lines(0, start_pos[2] - 1, start_pos[2], false)[1]:sub(start_pos[3], end_pos[3] - 1)
else
-- ε¦‚ζžœι€‰δΈ­ηš„ζ˜―ε€šθ‘Œζ–‡ζœ¬οΌŒεˆ™ιœ€θ¦εˆ†εˆ«θŽ·ε–ζ―δΈ€θ‘Œηš„ζ–‡ζœ¬
local selected_text = {}
for i = start_pos[2], end_pos[2] do
-- 使用 vim.api.nvim_buf_get_lines() ε‡½ζ•°θŽ·ε–ι€‰δΈ­ηš„ζ–‡ζœ¬
local line_text = vim.api.nvim_buf_get_lines(0, i - 1, i, false)[1]
-- ε¦‚ζžœζ˜―ι€‰δΈ­ηš„η¬¬δΈ€θ‘ŒοΌŒιœ€θ¦δ»Ž mark 'v' ηš„εˆ—εΌ€ε§‹θŽ·ε–
if i == start_pos[2] then
line_text = line_text:sub(start_pos[3])
end
-- ε¦‚ζžœζ˜―ι€‰δΈ­ηš„ζœ€εŽδΈ€θ‘ŒοΌŒιœ€θ¦θŽ·ε–εˆ°ε½“ε‰ε…‰ζ ‡ηš„εˆ—
-- If select last line, there need to get column of current cursor
if i == end_pos[2] then
line_text = line_text:sub(1, end_pos[3] - 1)
end
table.insert(selected_text, line_text)
end
-- θΎ“ε‡Ίε½“ε‰ι€‰δΈ­ηš„ζ–‡ζœ¬
return table.concat(selected_text, "\n")
end
end
Expand Down

0 comments on commit 1a46426

Please sign in to comment.