1
0
mirror of https://github.com/gryf/tagbar.git synced 2025-12-17 11:30:28 +01:00

Keep cursor on current tag when sorting, closes #200

This commit is contained in:
Jan Larres
2014-03-22 01:09:30 +13:00
parent 07b7e9b68e
commit b2c5f0b928

View File

@@ -2527,7 +2527,9 @@ function! s:ToggleSort() abort
return
endif
" Save the tag the cursor is currently on
let curline = line('.')
let taginfo = s:GetTagInfo(curline, 0)
match none
@@ -2544,7 +2546,13 @@ function! s:ToggleSort() abort
call s:RenderContent()
call s:SetStatusLine('current')
execute curline
" If we were on a tag before sorting then jump to it, otherwise restore
" the cursor to the current line
if !empty(taginfo)
execute taginfo.tline
else
execute curline
endif
endfunction
" Display {{{1