Fix #15: silly bug caused following non-special links to crash

This commit is contained in:
Rene Schallner
2021-12-01 14:24:45 +01:00
parent a626225399
commit 4914c9d639
2 changed files with 4 additions and 2 deletions

View File

@@ -388,7 +388,8 @@ You can `follow_link()` all of the above, with the exception of media links, whi
Note that notes linked to with headings or paragraph IDs **will not be created automatically**. Non-existing notes will Note that notes linked to with headings or paragraph IDs **will not be created automatically**. Non-existing notes will
be ignored, a global search will be performed instead. be ignored, a global search will be performed instead.
For now, you have to create such links yourself. You can edit existing links and append headings, for example: From `[[The note]]` to `[[The note#Some heading or subheading]]`. For now, you have to create such links yourself. You can edit existing links and append headings, for example: From
`[[The note]]` to `[[The note#Some heading or subheading]]`.
Regarding linking to paragraphs: The `^blockid` notation is supported by more and more tools now. It works like this: Regarding linking to paragraphs: The `^blockid` notation is supported by more and more tools now. It works like this:

View File

@@ -473,7 +473,7 @@ local function FollowLink(opts)
local search_mode = "files" local search_mode = "files"
local parts = vim.split(title, "#") local parts = vim.split(title, "#")
local filename local filename = ''
-- if there is a # -- if there is a #
if #parts ~= 1 then if #parts ~= 1 then
@@ -560,6 +560,7 @@ local function FollowLink(opts)
cwd = cwd, cwd = cwd,
prompt_title = "Notes referencing `" .. title .. "`", prompt_title = "Notes referencing `" .. title .. "`",
default_text = search_pattern, default_text = search_pattern,
-- link to specific file (a daily file): [[2021-02-22]]
-- link to heading in specific file (a daily file): [[2021-02-22#Touchpoint]] -- link to heading in specific file (a daily file): [[2021-02-22#Touchpoint]]
-- link to heading globally [[#Touchpoint]] -- link to heading globally [[#Touchpoint]]
-- link to heading in specific file (a daily file): [[The cool note#^xAcSh-xxr]] -- link to heading in specific file (a daily file): [[The cool note#^xAcSh-xxr]]