Skip to content

Commit

Permalink
Reset last-matched end index when looking for citations that fall und…
Browse files Browse the repository at this point in the history
…er the cursor (fixes issue #25)
  • Loading branch information
jakewvincent committed Apr 24, 2022
1 parent cb7093f commit eb95764
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lua/mkdnflow/links.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ getLinkPart() extracts part of a markdown link, i.e. the part in [] or ().
Returns a string--the string in the square brackets
--]]
M.getLinkPart = function(part)
print('looking for a link...')
-- Use 'path' as part if no argument provided
part = part or 'path'
-- Get current cursor position
Expand Down Expand Up @@ -99,6 +100,7 @@ M.getLinkPart = function(part)
end
else -- If one wasn't found, perform another search, this time for citations
unfound = true
last_fin = 1
while unfound do
local com, fin = string.find(line[1], bib_pattern, last_fin)
-- If there was a match, see if the cursor is inside it
Expand Down

0 comments on commit eb95764

Please sign in to comment.