Skip to content

Commit

Permalink
refactor: Rename betterGmatch -> gmatch
Browse files Browse the repository at this point in the history
  • Loading branch information
jakewvincent committed Jul 10, 2024
1 parent e856877 commit a1b9577
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lua/mkdnflow/links.lua
Original file line number Diff line number Diff line change
Expand Up @@ -865,7 +865,7 @@ M.createLink = function(args)
-- is, perform the search until a match is found whose right edge follows
-- the cursor position
if cursor_word ~= '' then
for _left, _right in utils.betterGmatch(line, cursor_word) do
for _left, _right in utils.gmatch(line, cursor_word) do
if _right >= col then
left = _left
right = _right
Expand Down
4 changes: 2 additions & 2 deletions lua/mkdnflow/tables.lua
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ local which_cell = function(row, col)
local cursorline = vim.api.nvim_buf_get_lines(0, row - 1, row, false)[1]
cursorline = cursorline:gsub('\\|', '##')
local init, cell, cursor_cell = 1, 1, nil
for start, finish in utils.betterGmatch(cursorline, '[^|]+') do
for start, finish in utils.gmatch(cursorline, '[^|]+') do
-- Find the indices of the match
if col + 1 >= start and col <= finish then
cursor_cell = cell
Expand All @@ -352,7 +352,7 @@ local locate_cell = function(table_row, target_cellnr, locate_cell_contents)
local start, finish
-- Internally replace any escaped bars
table_row = table_row:gsub('\\|', ' ')
for match_start, match_end, match in utils.betterGmatch(table_row, '([^|]+)') do
for match_start, match_end, match in utils.gmatch(table_row, '([^|]+)') do
cur_cell = cur_cell + 1
--start, finish = string.find(table_row, match, init, true)
if cur_cell == target_cellnr then
Expand Down
2 changes: 1 addition & 1 deletion lua/mkdnflow/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ M.spairs = function(tbl)
end
end

M.betterGmatch = function(text, pattern, start)
M.gmatch = function(text, pattern, start)
start = start ~= nil and start or 1
return function()
if not text then
Expand Down

0 comments on commit a1b9577

Please sign in to comment.