Skip to content

Commit

Permalink
fix: sort lines
Browse files Browse the repository at this point in the history
  • Loading branch information
kdnk committed Feb 19, 2024
1 parent ef6a3a8 commit 3e25551
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lua/bookmarks-cycle-through/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,15 @@ local get_file_index = function(file)
end

local get_line_index = function(file, line)
local lines = vim.fn["bm#all_lines"](file)
local lines = int_lines(file)
table.sort(lines)
lines = int_lines(file)
return list_find_index(lines, line)
end

local get_last_line_index = function(file_index)
return #vim.fn["bm#all_lines"](vim.fn["bm#all_files"]()[file_index])
local file = vim.fn["bm#all_files"]()[file_index]
return #int_lines(file)
end

local goto_file_line = function(file, line)
Expand All @@ -52,7 +53,7 @@ end
function M.bookmark_count_or_index()
local bookmarks = {}
for _, file in ipairs(vim.fn["bm#all_files"]()) do
local lines = vim.fn["bm#all_lines"](file)
local lines = int_lines(file)
table.sort(lines)
for _, line in ipairs(lines) do
table.insert(bookmarks, file .. ":" .. line)
Expand Down

0 comments on commit 3e25551

Please sign in to comment.