Fix: Jump to nested anchor bugged with markdown (issue #1356)

This commit is contained in:
Tinmarino
2023-07-10 12:19:52 -04:00
parent acc92fb648
commit 09804c2a5f
2 changed files with 151 additions and 4 deletions
+3 -4
View File
@@ -882,6 +882,9 @@ function! s:jump_to_anchor(anchor) abort
let anchor = vimwiki#u#escape(a:anchor)
let segments = split(anchor, '#', 0)
" Start at beginning => Independent of link position
call cursor(1, 1)
" For markdown: there is only one segment
for segment in segments
" Craft segment pattern so that it is case insensitive and also matches dashes
@@ -902,7 +905,6 @@ function! s:jump_to_segment(segment, segment_norm_re, segment_nb) abort
" Called: jump_to_anchor with suffix and withtou suffix
" Save cursor %% Initialize at top of line
let oldpos = getpos('.')
call cursor(1, 1)
" Get anchor regex
let anchor_header = s:safesubstitute(
@@ -960,9 +962,6 @@ function! s:jump_to_segment(segment, segment_norm_re, segment_nb) abort
return 0
endif
" Or keep on (i.e more than once segment)
let oldpos = getpos('.')
" Said 'fail' to caller
return 1
endfunction