File tree Expand file tree Collapse file tree 1 file changed +17
-17
lines changed
Expand file tree Collapse file tree 1 file changed +17
-17
lines changed Original file line number Diff line number Diff line change @@ -265,27 +265,27 @@ enddef
265265export def RemoveLink (range_info: dict <list<list<number> >> = {})
266266 const link_info = empty (range_info) ? IsLink () : range_info
267267 # TODO : it may not be the best but it works so far
268- echom " link_info: " .. string (link_info)
269268 if ! empty (link_info)
270- # TODO : bug distance ahead from the cursor position
271-
272- var symbol = utils.IsLess (searchpos (' [' , ' n' ), searchpos (' (' , ' n' ))
273- ? ' ['
274- : ' ('
269+ # Find the closest between [ and (
270+ var symbol = ' '
271+ if searchpos (' [' , ' nW' ) == [0 , 0 ]
272+ symbol = ' ('
273+ elseif searchpos (' (' , ' nW' ) == [0 , 0 ]
274+ symbol = ' ['
275+ else
276+ symbol = utils.IsLess (searchpos (' [' , ' nW' ), searchpos (' (' , ' nW' ))
277+ ? ' ['
278+ : ' ('
279+ endif
275280 # Remove actual link
276- #
277- echom " pos [: " .. string (searchpos (' [' , ' n' ))
278- echom " pos (: " .. string (searchpos (' (' , ' n' ))
279- echom utils.IsLess (searchpos (' [' , ' n' ), searchpos (' (' , ' n' ))
280- echom " symbol: " .. symbol
281281 search (symbol)
282- # exe $ ' norm! "_da{symbol}'
282+ exe $ ' norm! "_da{symbol}'
283283
284- # # Remove text link
285- # search (' ]' , ' bc' )
286- # norm! " _x
287- # search (' [' , ' bc' )
288- # norm! " _x
284+ # Remove text link
285+ search (' ]' , ' bc' )
286+ norm! " _x
287+ search (' [' , ' bc' )
288+ norm! " _x
289289 endif
290290enddef
291291
You can’t perform that action at this time.
0 commit comments