mirror of
https://github.com/Ascyii/telekasten.nvim.git
synced 2026-01-01 06:14:23 -05:00
fixed is_tag_or_link_at() for links containing whitespace
This commit is contained in:
@@ -9,6 +9,8 @@ M.is_tag_or_link_at = function(line, col, opts)
|
|||||||
and line:sub(1, 4) == "tags"
|
and line:sub(1, 4) == "tags"
|
||||||
|
|
||||||
local seen_bracket = false
|
local seen_bracket = false
|
||||||
|
local cannot_be_tag = false
|
||||||
|
|
||||||
while col >= 1 do
|
while col >= 1 do
|
||||||
char = line:sub(col, col)
|
char = line:sub(col, col)
|
||||||
|
|
||||||
@@ -30,16 +32,20 @@ M.is_tag_or_link_at = function(line, col, opts)
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
if char == "#" and opts.tag_notation == "#tag" then
|
if char == "#" and opts.tag_notation == "#tag" then
|
||||||
|
if not cannot_be_tag then
|
||||||
return "tag", col
|
return "tag", col
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if char == ":" and opts.tag_notation == ":tag:" then
|
if char == ":" and opts.tag_notation == ":tag:" then
|
||||||
|
if not cannot_be_tag then
|
||||||
return "tag", col
|
return "tag", col
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if char == " " or char == "\t" then
|
if char == " " or char == "\t" then
|
||||||
return nil, nil
|
cannot_be_tag = true
|
||||||
end
|
end
|
||||||
col = col - 1
|
col = col - 1
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user