Skip to content

Commit 692479e

Browse files
committed
fix: len compute
1 parent fb1370b commit 692479e

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lua/search-and-replace/state.lua

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,15 @@ function state:backup_qflist(scope)
4747
self.backup = {}
4848

4949
local qflist = vim.fn.getqflist({ items = 0 }).items
50-
log.debug(scope, "found %d items in qflist", vim.fn.len(qflist))
5150

52-
if #qflist == 0 then
51+
if vim.fn.len(qflist) == 0 then
5352
log.debug(scope, "no match found for %s", self.selection)
5453

5554
return false
5655
end
5756

57+
log.debug(scope, "found %d items in qflist", vim.fn.len(qflist))
58+
5859
for _, item in ipairs(qflist) do
5960
local bufnr = item.bufnr
6061
if bufnr > 0 and vim.api.nvim_buf_is_valid(bufnr) then

lua/search-and-replace/util/api.lua

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ local api = {}
77
---@private
88
function api.replace(selection, replace)
99
selection = selection or ""
10-
vim.print("cfdo %s/" .. selection .. "/" .. replace .. "/g")
1110
vim.cmd("cfdo %s/" .. selection .. "/" .. replace .. "/g")
1211
vim.cmd("cfdo update")
1312
end
@@ -31,7 +30,7 @@ function api.get_visual_selection()
3130

3231
-- shouldn't happen but in case it does
3332
local lines = vim.fn.getline(line_start, line_end)
34-
if #lines ~= 1 then
33+
if vim.fn.len(lines) == 1 then
3534
return nil
3635
end
3736

0 commit comments

Comments
 (0)