This commit is contained in:
Damien Mehala 2024-09-15 20:56:57 +08:00 committed by GitHub
commit a83188ff3a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -206,6 +206,7 @@ end
---@returns string
local function buf_range_get_text(buf, range)
local start_row, start_col, end_row, end_col = M._range.unpack4(range)
local insert_nl = false
if end_col == 0 then
if start_row == end_row then
start_col = -1
@ -213,8 +214,12 @@ local function buf_range_get_text(buf, range)
end
end_col = -1
end_row = end_row - 1
insert_nl = true
end
local lines = api.nvim_buf_get_text(buf, start_row, start_col, end_row, end_col, {})
if insert_nl then
table.insert(lines, "")
end
return table.concat(lines, '\n')
end