Skip to content

Commit 30f506a

Browse files
majutsushivim-scripts
authored andcommitted
Version 2.0.1: - Fixed sorting bug when 'ignorecase' is set
1 parent 834f6fe commit 30f506a

File tree

3 files changed

+20
-15
lines changed

3 files changed

+20
-15
lines changed

doc/tagbar.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Author: Jan Larres <jan@majutsushi.net>
44
Licence: Vim licence, see |license|
55
Homepage: http://majutsushi.github.com/tagbar/
6-
Version: 2.0
6+
Version: 2.0.1
77

88
==============================================================================
99
Contents *tagbar* *tagbar-contents*
@@ -339,7 +339,9 @@ g:tagbar_sort~
339339
Default: 1
340340

341341
If this option is set the tags are sorted according to their name. If it is
342-
unset they are sorted according to their order in the source file.
342+
unset they are sorted according to their order in the source file. Note that
343+
in the second case Pseudo-tags are always sorted before normal tags of the
344+
same kind since they don't have a real position in the file.
343345

344346
Example:
345347
>
@@ -778,6 +780,9 @@ files.
778780
==============================================================================
779781
8. History *tagbar-history*
780782

783+
2.0.1 (2011-04-26)
784+
- Fix sorting bug when 'ignorecase' is set
785+
781786
2.0 (2011-04-26)
782787
- Folding now works correctly. Folds will be preserved when leaving the
783788
Tagbar window and when switching between files. Also tag types can be

plugin/tagbar.vim

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
" Author: Jan Larres <jan@majutsushi.net>
55
" Licence: Vim licence
66
" Website: http://majutsushi.github.com/tagbar/
7-
" Version: 2.0
7+
" Version: 2.0.1
88
" Note: This plugin was heavily inspired by the 'Taglist' plugin by
99
" Yegappan Lakshmanan and uses a small amount of code from it.
1010
"
@@ -1575,7 +1575,7 @@ function! s:ParseTagline(part1, part2, typeinfo, fileinfo)
15751575
let pattern = join(basic_info[2:], "\t")
15761576
let start = 2 " skip the slash and the ^
15771577
let end = strlen(pattern) - 1
1578-
if pattern[end - 1] == '$'
1578+
if pattern[end - 1] ==# '$'
15791579
let end -= 1
15801580
let dollar = '\$'
15811581
else
@@ -1650,9 +1650,9 @@ function! s:AddScopedTags(tags, processedtags, parent, depth,
16501650
" or at least a proper grandchild with pseudo-tags in between. If it
16511651
" is a direct child also check for matching scope.
16521652
let is_cur_tag .= ' &&
1653-
\ (v:val.path == curpath ||
1653+
\ (v:val.path ==# curpath ||
16541654
\ match(v:val.path, ''\V\^\C'' . curpath . a:typeinfo.sro) == 0) &&
1655-
\ (v:val.path == curpath ? (v:val.scope == pscope) : 1)'
1655+
\ (v:val.path ==# curpath ? (v:val.scope ==# pscope) : 1)'
16561656
endif
16571657

16581658
let curtags = filter(copy(a:tags), is_cur_tag)
@@ -1732,7 +1732,7 @@ function! s:ProcessPseudoTag(curtags, tag, parent, typeinfo, fileinfo)
17321732
let pseudotag.children = [a:tag]
17331733

17341734
" get all the other (direct) children of the current pseudo-tag
1735-
let ispseudochild = 'v:val.path == a:tag.path && v:val.scope == a:tag.scope'
1735+
let ispseudochild = 'v:val.path ==# a:tag.path && v:val.scope ==# a:tag.scope'
17361736
let pseudochildren = filter(copy(a:curtags), ispseudochild)
17371737
if !empty(pseudochildren)
17381738
call filter(a:curtags, '!(' . ispseudochild . ')')
@@ -1819,27 +1819,27 @@ endfunction
18191819
function! s:CompareByKind(tag1, tag2)
18201820
let typeinfo = s:compare_typeinfo
18211821

1822-
if typeinfo.kinddict[a:tag1.fields.kind] <
1822+
if typeinfo.kinddict[a:tag1.fields.kind] <#
18231823
\ typeinfo.kinddict[a:tag2.fields.kind]
18241824
return -1
1825-
elseif typeinfo.kinddict[a:tag1.fields.kind] >
1825+
elseif typeinfo.kinddict[a:tag1.fields.kind] >#
18261826
\ typeinfo.kinddict[a:tag2.fields.kind]
18271827
return 1
18281828
else
18291829
" Ignore '~' prefix for C++ destructors to sort them directly under
18301830
" the constructors
1831-
if a:tag1.name[0] == '~'
1831+
if a:tag1.name[0] ==# '~'
18321832
let name1 = a:tag1.name[1:]
18331833
else
18341834
let name1 = a:tag1.name
18351835
endif
1836-
if a:tag2.name[0] == '~'
1836+
if a:tag2.name[0] ==# '~'
18371837
let name2 = a:tag2.name[1:]
18381838
else
18391839
let name2 = a:tag2.name
18401840
endif
18411841

1842-
if name1 <= name2
1842+
if name1 <=# name2
18431843
return -1
18441844
else
18451845
return 1
@@ -1902,7 +1902,7 @@ function! s:RenderContent(...)
19021902
endif
19031903

19041904
if !empty(s:known_files.getCurrent()) &&
1905-
\ fileinfo.fpath == s:known_files.getCurrent().fpath
1905+
\ fileinfo.fpath ==# s:known_files.getCurrent().fpath
19061906
" We're redisplaying the same file, so save the view
19071907
let saveline = line('.')
19081908
let savecol = col('.')
@@ -1935,7 +1935,7 @@ function! s:RenderContent(...)
19351935
setlocal nomodifiable
19361936

19371937
if !empty(s:known_files.getCurrent()) &&
1938-
\ fileinfo.fpath == s:known_files.getCurrent().fpath
1938+
\ fileinfo.fpath ==# s:known_files.getCurrent().fpath
19391939
let scrolloff_save = &scrolloff
19401940
set scrolloff=0
19411941

syntax/tagbar.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
" Author: Jan Larres <jan@majutsushi.net>
44
" Licence: Vim licence
55
" Website: http://majutsushi.github.com/tagbar/
6-
" Version: 2.0
6+
" Version: 2.0.1
77

88
if exists("b:current_syntax")
99
finish

0 commit comments

Comments
 (0)