Skip to content

Commit e3c9dd0

Browse files
committed
fix: don't run twice for last match
1 parent acc1f5a commit e3c9dd0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

scripts/generate_colors.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,13 @@ end
8080
local function iterate_colors(proc)
8181
-- move to first line
8282
vim.cmd ":1"
83-
local cursor
83+
local cursor = fn.search "\\scolor ="
8484
-- fn.search will return 0 when no more matches are found with falsy `wrapscan`
8585
while cursor ~= 0 do
86-
cursor = fn.search "\\scolor ="
8786
local rrggbb = vim.api.nvim_get_current_line():match '"(#%x%x%x%x%x%x)"'
8887
proc(rrggbb)
8988
vim.cmd "normal! $"
89+
cursor = fn.search "\\scolor ="
9090
end
9191
end
9292

0 commit comments

Comments
 (0)