Upgrade taglist from 4.5 to 4.6
dblume

dblume commited on 2024-04-01 23:07:22
Showing 4 changed files, with 240 additions and 52 deletions.


Bumping from the 2007 version to the 2013 in GitHub.

  git clone --filter=blob:none -b v4.6 \
            https://github.com/yegappan/taglist \
            ~/.local/share/nvim/site/plugin/
... ...
@@ -0,0 +1,24 @@
1
+Copyright (c) 2014, Yegappan Lakshmanan
2
+All rights reserved.
3
+
4
+Redistribution and use in source and binary forms, with or without
5
+modification, are permitted provided that the following conditions are met:
6
+
7
+* Redistributions of source code must retain the above copyright notice, this
8
+  list of conditions and the following disclaimer.
9
+
10
+* Redistributions in binary form must reproduce the above copyright notice,
11
+  this list of conditions and the following disclaimer in the documentation
12
+  and/or other materials provided with the distribution.
13
+
14
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
15
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
18
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
20
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
21
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
22
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
+
... ...
@@ -0,0 +1,19 @@
1
+taglist - Source Code Browser plugin for Vim
2
+============================================
3
+
4
+The "Tag List" plugin is a source code browser plugin for Vim and 
5
+provides an overview of the structure of source code files and allows 
6
+you to efficiently browse through source code files for different 
7
+programming languages.  You can visit the taglist plugin home page for 
8
+more information: 
9
+
10
+      http://vim-taglist.sourceforge.net 
11
+
12
+You can subscribe to the taglist mailing list to post your questions 
13
+or suggestions for improvement or to report bugs. Visit the following 
14
+page for subscribing to the mailing list: 
15
+
16
+      http://groups.yahoo.com/group/taglist/ 
17
+
18
+For more information about using this plugin, after installing the 
19
+taglist plugin, use the ":help taglist" command.
... ...
@@ -2,7 +2,7 @@
2 2
 
3 3
 Author: Yegappan Lakshmanan  (yegappan AT yahoo DOT com)
4 4
 For Vim version 6.0 and above
5
-Last change: 2007 May 24
5
+Last change: 2013 Feburary 26
6 6
 
7 7
 1. Overview 					|taglist-intro|
8 8
 2. Taglist on the internet			|taglist-internet|
... ...
@@ -759,6 +759,12 @@ loaded. Examples:
759 759
 >
760 760
 	let Tlist_Ctags_Cmd = 'd:\tools\ctags.exe'
761 761
 	let Tlist_Ctags_Cmd = '/usr/local/bin/ctags'
762
+<
763
+On Microsoft Windows, if ctags.exe is installed in a directory with space
764
+characters in the name (e.g. C:\Program Files\ctags\ctags.exe), then you need
765
+to set the Tlist_Ctags_Cmd variable like this:
766
+>
767
+	let Tlist_Ctags_Cmd = '"C:\Program Files\ctags\ctags.exe"'
762 768
 <
763 769
 						*'Tlist_Display_Prototype'*
764 770
 Tlist_Display_Prototype~
... ...
@@ -841,6 +847,7 @@ If your terminal doesn't support changing the window width from Vim (older
841 847
 version of xterm running in a Unix system) or if you see any weird problems in
842 848
 the screen due to the change in the window width or if you prefer not to
843 849
 adjust the window width then set the 'Tlist_Inc_Winwidth' variable to zero.
850
+If you are using GNU Screen, you may want to set this variable to zero.
844 851
 CAUTION: If you are using the MS-Windows version of Vim in a MS-DOS command
845 852
 window then you must set this variable to zero, otherwise the system may hang
846 853
 due to a Vim limitation (explained in :help win32-problems)
... ...
@@ -1144,6 +1151,7 @@ The taglist plugin provides several global functions that can be used from
1144 1151
 other Vim plugins to interact with the taglist plugin. These functions are
1145 1152
 described below.
1146 1153
 
1154
+|Tlist_Get_Filenames()|			Return filenames in the taglist
1147 1155
 |Tlist_Update_File_Tags()|		Update the tags for the specified file
1148 1156
 |Tlist_Get_Tag_Prototype_By_Line()|	Return the prototype of the tag at or
1149 1157
 				    	before the specified line number in the
... ...
@@ -1154,6 +1162,12 @@ described below.
1154 1162
 |Tlist_Set_App()|			Set the name of the application
1155 1163
 					controlling the taglist window.
1156 1164
 
1165
+					    *Tlist_Get_Filenames()*
1166
+Tlist_Get_Filenames()
1167
+		Returns a list of filenames in the taglist. Each filename is
1168
+		separated by a newline (\n) character. If the taglist is empty
1169
+		an empty string is returned.
1170
+
1157 1171
 					    *Tlist_Update_File_Tags()*
1158 1172
 Tlist_Update_File_Tags({filename}, {filetype})
1159 1173
 		Update the tags for the file {filename}. The second argument
... ...
@@ -1,8 +1,8 @@
1 1
 " File: taglist.vim
2 2
 " Author: Yegappan Lakshmanan (yegappan AT yahoo DOT com)
3
-" Version: 4.5
4
-" Last Modified: September 21, 2007
5
-" Copyright: Copyright (C) 2002-2007 Yegappan Lakshmanan
3
+" Version: 4.6
4
+" Last Modified: Feb 26, 2013
5
+" Copyright: Copyright (C) 2002-2013 Yegappan Lakshmanan
6 6
 "            Permission is hereby granted to use and distribute this code,
7 7
 "            with or without modifications, provided that this copyright
8 8
 "            notice is copied with it. Like anything else that's free,
... ...
@@ -57,7 +57,12 @@
57 57
 " ****************** Do not modify after this line ************************
58 58
 
59 59
 " Line continuation used here
60
+if !exists('s:cpo_save')
61
+    " If the taglist plugin is sourced recursively, the 'cpo' setting will be
62
+    " set to the default value.  To avoid this problem, save the cpo setting
63
+    " only when the plugin is loaded for the first time.
60 64
     let s:cpo_save = &cpo
65
+endif
61 66
 set cpo&vim
62 67
 
63 68
 if !exists('loaded_taglist')
... ...
@@ -329,6 +334,7 @@ endif
329 334
 if !exists('s:tlist_sid')
330 335
     " Two or more versions of taglist plugin are installed. Don't
331 336
     " load this version of the plugin.
337
+    let &cpo = s:cpo_save
332 338
     finish
333 339
 endif
334 340
 
... ...
@@ -363,18 +369,28 @@ let loaded_taglist = 'available'
363 369
 "               tags of this type
364 370
 "
365 371
 
372
+" Ant language
373
+let s:tlist_def_ant_settings = 'ant;p:projects;t:targets'
374
+
366 375
 " assembly language
367 376
 let s:tlist_def_asm_settings = 'asm;d:define;l:label;m:macro;t:type'
368 377
 
369 378
 " aspperl language
370
-let s:tlist_def_aspperl_settings = 'asp;f:function;s:sub;v:variable'
379
+let s:tlist_def_aspperl_settings =
380
+            \ 'asp;c:constants;v:variable;f:function;s:subroutine'
371 381
 
372 382
 " aspvbs language
373
-let s:tlist_def_aspvbs_settings = 'asp;f:function;s:sub;v:variable'
383
+let s:tlist_def_aspvbs_settings =
384
+            \ 'asp;c:constants;v:variable;f:function;s:subroutine'
374 385
 
375 386
 " awk language
376 387
 let s:tlist_def_awk_settings = 'awk;f:function'
377 388
 
389
+" basic language
390
+let s:tlist_def_basic_settings =
391
+            \ 'basic;c:constant;l:label;g:enum;v:variable;' .
392
+            \ 't:type;f:function'
393
+
378 394
 " beta language
379 395
 let s:tlist_def_beta_settings = 'beta;f:fragment;s:slot;v:pattern'
380 396
 
... ...
@@ -394,6 +410,12 @@ let s:tlist_def_cs_settings = 'c#;d:macro;t:typedef;n:namespace;c:class;' .
394 410
 " cobol language
395 411
 let s:tlist_def_cobol_settings = 'cobol;d:data;f:file;g:group;p:paragraph;' .
396 412
                                \ 'P:program;s:section'
413
+" D programming language
414
+let s:tlist_def_d_settings = 'c++;n:namespace;v:variable;t:typedef;' .
415
+                        \'c:class;g:enum;s:struct;u:union;f:function'
416
+
417
+" Dosbatch
418
+let s:tlist_def_dosbatch_settings = 'dosbatch;l:labels;v:variables'
397 419
 
398 420
 " eiffel language
399 421
 let s:tlist_def_eiffel_settings = 'eiffel;c:class;f:feature'
... ...
@@ -404,20 +426,28 @@ let s:tlist_def_erlang_settings = 'erlang;d:macro;r:record;m:module;f:function'
404 426
 " expect (same as tcl) language
405 427
 let s:tlist_def_expect_settings = 'tcl;c:class;f:method;p:procedure'
406 428
 
429
+" flex
430
+let s:tlist_def_flex_settings = 'flex;v:global;c:classes;p:properties;'.
431
+            \ 'm:methods;f:functions;x:mxtags'
432
+
407 433
 " fortran language
408 434
 let s:tlist_def_fortran_settings = 'fortran;p:program;b:block data;' .
409 435
                     \ 'c:common;e:entry;i:interface;k:type;l:label;m:module;' .
410 436
                     \ 'n:namelist;t:derived;v:variable;f:function;s:subroutine'
411 437
 
438
+" GO language
439
+let s:tlist_def_go_settings = 'go;f:function;p:package;t:struct'
440
+
412 441
 " HTML language
413
-let s:tlist_def_html_settings = 'html;a:anchor;f:javascript function'
442
+let s:tlist_def_html_settings = 'html;a:anchor;f:function'
414 443
 
415 444
 " java language
416 445
 let s:tlist_def_java_settings = 'java;p:package;c:class;i:interface;' .
417
-                              \ 'f:field;m:method'
446
+                              \ 'g:enum;f:field;m:method'
418 447
 
419 448
 " javascript language
420
-let s:tlist_def_javascript_settings = 'javascript;f:function'
449
+let s:tlist_def_javascript_settings =
450
+            \ 'javascript;c:class;m:method;v:global;f:function;p:properties'
421 451
 
422 452
 " lisp language
423 453
 let s:tlist_def_lisp_settings = 'lisp;f:function'
... ...
@@ -428,6 +458,13 @@ let s:tlist_def_lua_settings = 'lua;f:function'
428 458
 " makefiles
429 459
 let s:tlist_def_make_settings = 'make;m:macro'
430 460
 
461
+" Matlab
462
+let s:tlist_def_matlab_settings = 'matlab;f:function'
463
+
464
+" Ocamal
465
+let s:tlist_def_ocamal_settings = 'ocamal;M:module;v:global;t:type;'.
466
+            \ 'c:class;f:function;m:method;C:constructor;e:exception'
467
+
431 468
 " pascal language
432 469
 let s:tlist_def_pascal_settings = 'pascal;f:function;p:procedure'
433 470
 
... ...
@@ -435,11 +472,15 @@ let s:tlist_def_pascal_settings = 'pascal;f:function;p:procedure'
435 472
 let s:tlist_def_perl_settings = 'perl;c:constant;l:label;p:package;s:subroutine'
436 473
 
437 474
 " php language
438
-let s:tlist_def_php_settings = 'php;c:class;d:constant;v:variable;f:function'
475
+let s:tlist_def_php_settings =
476
+            \ 'php;c:class;i:interface;d:constant;v:variable;f:function'
439 477
 
440 478
 " python language
441 479
 let s:tlist_def_python_settings = 'python;c:class;m:member;f:function'
442 480
 
481
+" cython language
482
+let tlist_pyrex_settings='python;c:classe;m:memder;f:function'
483
+
443 484
 " rexx language
444 485
 let s:tlist_def_rexx_settings = 'rexx;s:subroutine'
445 486
 
... ...
@@ -464,15 +505,28 @@ let s:tlist_def_slang_settings = 'slang;n:namespace;f:function'
464 505
 
465 506
 " sml language
466 507
 let s:tlist_def_sml_settings = 'sml;e:exception;c:functor;s:signature;' .
467
-                             \ 'r:structure;t:type;v:value;f:function'
508
+            \ 'r:structure;t:type;v:value;c:functor;f:function'
468 509
 
469 510
 " sql language
470
-let s:tlist_def_sql_settings = 'sql;c:cursor;F:field;P:package;r:record;' .
471
-            \ 's:subtype;t:table;T:trigger;v:variable;f:function;p:procedure'
511
+let s:tlist_def_sql_settings = 'sql;f:functions;' .
512
+           \ 'P:packages;p:procedures;t:tables;T:triggers;' .
513
+           \ 'v:variables;e:events;U:publications;R:services;' .
514
+           \ 'D:domains;x:MLTableScripts;y:MLConnScripts;z:MLProperties;'.
515
+           \ 'i:indexes;c:cursors;V:views;'.
516
+           \ 'd:prototypes;'.
517
+           \ 'l:local variables;'.
518
+           \ 'F:record fields;'.
519
+           \ 'L:block label;'.
520
+           \ 'r:records;'.
521
+           \ 's:subtypes'
472 522
 
473 523
 " tcl language
474 524
 let s:tlist_def_tcl_settings = 'tcl;c:class;f:method;m:method;p:procedure'
475 525
 
526
+" Tex
527
+let s:tlist_def_tex_settings = 'tex;c:chapters;s:sections;u:subsections;'.
528
+            \ 'b:subsubsections;p:parts;P:paragraphs;G:subparagraphs'
529
+
476 530
 " vera language
477 531
 let s:tlist_def_vera_settings = 'vera;c:class;d:macro;e:enumerator;' .
478 532
                                 \ 'f:function;g:enum;m:member;p:program;' .
... ...
@@ -483,8 +537,12 @@ let s:tlist_def_vera_settings = 'vera;c:class;d:macro;e:enumerator;' .
483 537
 let s:tlist_def_verilog_settings = 'verilog;m:module;c:constant;P:parameter;' .
484 538
             \ 'e:event;r:register;t:task;w:write;p:port;v:variable;f:function'
485 539
 
540
+" VHDL
541
+let s:tlist_def_vhdl_settings = 'vhdl;c:constant;t:type;T:subtype;r:record;e:entity;f:function;p:procedure;P:package'
542
+
486 543
 " vim language
487
-let s:tlist_def_vim_settings = 'vim;a:autocmds;v:variable;f:function'
544
+let s:tlist_def_vim_settings =
545
+            \ 'vim;v:variable;a:autocmds;c:commands;m:map;f:function'
488 546
 
489 547
 " yacc language
490 548
 let s:tlist_def_yacc_settings = 'yacc;l:label'
... ...
@@ -983,6 +1041,12 @@ endfunction
983 1041
 function! s:Tlist_Get_Buffer_Filetype(bnum)
984 1042
     let buf_ft = getbufvar(a:bnum, '&filetype')
985 1043
 
1044
+    " Check whether 'filetype' contains multiple file types separated by '.'
1045
+    " If it is, then use the first file type
1046
+    if buf_ft =~ '\.'
1047
+        let buf_ft = matchstr(buf_ft, '[^.]\+')
1048
+    endif
1049
+
986 1050
     if bufloaded(a:bnum)
987 1051
         " For loaded buffers, the 'filetype' is already determined
988 1052
         return buf_ft
... ...
@@ -1021,6 +1085,7 @@ function! s:Tlist_Discard_TagInfo(fidx)
1021 1085
         unlet! {fidx_i}_tag_type
1022 1086
         unlet! {fidx_i}_ttype_idx
1023 1087
         unlet! {fidx_i}_tag_proto
1088
+        unlet! {fidx_i}_tag_scope
1024 1089
         unlet! {fidx_i}_tag_searchpat
1025 1090
         unlet! {fidx_i}_tag_linenum
1026 1091
         let i = i + 1
... ...
@@ -1206,6 +1271,7 @@ function! s:Tlist_Remove_File(file_idx, user_request)
1206 1271
             let s:tlist_{j}_{k}_tag_type = s:Tlist_Get_Tag_Type_By_Tag(i, k)
1207 1272
             let s:tlist_{j}_{k}_ttype_idx = s:tlist_{i}_{k}_ttype_idx
1208 1273
             let s:tlist_{j}_{k}_tag_proto = s:Tlist_Get_Tag_Prototype(i, k)
1274
+            let s:tlist_{j}_{k}_tag_scope = s:Tlist_Get_Tag_Scope(i, k)
1209 1275
             let s:tlist_{j}_{k}_tag_searchpat = s:Tlist_Get_Tag_SearchPat(i, k)
1210 1276
             let s:tlist_{j}_{k}_tag_linenum = s:Tlist_Get_Tag_Linenum(i, k)
1211 1277
             let k = k + 1
... ...
@@ -1328,7 +1394,9 @@ function! s:Tlist_Window_Create()
1328 1394
     endif
1329 1395
 
1330 1396
     " Create the taglist window
1331
-    exe 'silent! ' . win_dir . ' ' . win_size . 'split ' . wcmd
1397
+    " Preserve the alternate file
1398
+    let cmd_mod = (v:version >= 700) ? 'keepalt ' : ''
1399
+    exe 'silent! ' . cmd_mod . win_dir . ' ' . win_size . 'split ' . wcmd
1332 1400
 
1333 1401
     " Save the new window position
1334 1402
     let s:tlist_winx = getwinposx()
... ...
@@ -1422,6 +1490,11 @@ function! s:Tlist_Window_Exit_Only_Window()
1422 1490
 	if winbufnr(2) == -1
1423 1491
 	    if tabpagenr('$') == 1
1424 1492
 		" Only one tag page is present
1493
+                "
1494
+                " When deleting the taglist buffer, autocommands cannot be
1495
+                " disabled. If autocommands are disabled, then on exiting Vim,
1496
+                " the window size will not be restored back to the original
1497
+                " size.
1425 1498
                 bdelete
1426 1499
 		quit
1427 1500
 	    else
... ...
@@ -1526,6 +1599,9 @@ function! s:Tlist_Window_Init()
1526 1599
     " taglist window. So forcefully disable 'number' option for the taglist
1527 1600
     " window
1528 1601
     silent! setlocal nonumber
1602
+    if exists('&relativenumber')
1603
+        silent! setlocal norelativenumber
1604
+    endif
1529 1605
 
1530 1606
     " Use fixed height when horizontally split window is used
1531 1607
     if g:Tlist_Use_Horiz_Window
... ...
@@ -1948,11 +2024,6 @@ function! s:Tlist_Window_Refresh_File(filename, ftype)
1948 2024
 
1949 2025
             let {fidx_ttype}_offset = ttype_start_lnum - file_start
1950 2026
 
1951
-            " create a fold for this tag type
1952
-            let fold_start = ttype_start_lnum
1953
-            let fold_end = fold_start + {fidx_ttype}_count
1954
-            exe fold_start . ',' . fold_end  . 'fold'
1955
-
1956 2027
             " Adjust the cursor position
1957 2028
             if g:Tlist_Compact_Format == 0
1958 2029
                 exe ttype_start_lnum + {fidx_ttype}_count
... ...
@@ -1976,10 +2047,7 @@ function! s:Tlist_Window_Refresh_File(filename, ftype)
1976 2047
 
1977 2048
     let s:tlist_{fidx}_end = line('.') - 1
1978 2049
 
1979
-    " Create a fold for the entire file
1980
-    exe s:tlist_{fidx}_start . ',' . s:tlist_{fidx}_end . 'fold'
1981
-    exe 'silent! ' . s:tlist_{fidx}_start . ',' .
1982
-                \ s:tlist_{fidx}_end . 'foldopen!'
2050
+    call s:Tlist_Create_Folds_For_File(fidx)
1983 2051
 
1984 2052
     " Goto the starting line for this file,
1985 2053
     exe s:tlist_{fidx}_start
... ...
@@ -2087,6 +2155,25 @@ function! s:Tlist_Get_Tag_Prototype(fidx, tidx)
2087 2155
     return {tproto_var}
2088 2156
 endfunction
2089 2157
 
2158
+" Tlist_Get_Tag_Scope
2159
+" Get the scope (e.g. C++ class) of a tag
2160
+"
2161
+" Tag scope is the last field after the 'line:<num>\t' field
2162
+function! s:Tlist_Get_Tag_Scope(fidx, tidx)
2163
+    let tscope_var = 's:tlist_' . a:fidx . '_' . a:tidx . '_tag_scope'
2164
+
2165
+    " Already parsed and have the tag scope
2166
+    if exists(tscope_var)
2167
+        return {tscope_var}
2168
+    endif
2169
+
2170
+    " Parse and extract the tag scope
2171
+    let tag_line = s:tlist_{a:fidx}_{a:tidx}_tag
2172
+    let {tscope_var} = s:Tlist_Extract_Tag_Scope(tag_line)
2173
+
2174
+    return {tscope_var}
2175
+endfunction
2176
+
2090 2177
 " Tlist_Get_Tag_SearchPat
2091 2178
 function! s:Tlist_Get_Tag_SearchPat(fidx, tidx)
2092 2179
     let tpat_var = 's:tlist_' . a:fidx . '_' . a:tidx . '_tag_searchpat'
... ...
@@ -2186,7 +2273,7 @@ function! s:Tlist_Parse_Tagline(tag_line)
2186 2273
         " Add the tag scope, if it is available and is configured. Tag
2187 2274
         " scope is the last field after the 'line:<num>\t' field
2188 2275
         if g:Tlist_Display_Tag_Scope
2189
-            let tag_scope = s:Tlist_Extract_Tag_Scope(a:tag_line)
2276
+            let tag_scope = s:Tlist_Get_Tag_Scope(s:fidx, s:tidx)
2190 2277
             if tag_scope != ''
2191 2278
                 let ttxt = ttxt . ' [' . tag_scope . ']'
2192 2279
             endif
... ...
@@ -2275,9 +2362,13 @@ function! s:Tlist_Process_File(filename, ftype)
2275 2362
         " Contributed by: David Fishburn.
2276 2363
         let s:taglist_tempfile = fnamemodify(tempname(), ':h') .
2277 2364
                     \ '\taglist.cmd'
2365
+        if v:version >= 700
2366
+            call writefile([ctags_cmd], s:taglist_tempfile, "b")
2367
+        else
2278 2368
             exe 'redir! > ' . s:taglist_tempfile
2279 2369
             silent echo ctags_cmd
2280 2370
             redir END
2371
+        endif
2281 2372
 
2282 2373
         call s:Tlist_Log_Msg('Cmd inside batch file: ' . ctags_cmd)
2283 2374
         let ctags_cmd = '"' . s:taglist_tempfile . '"'
... ...
@@ -2401,7 +2492,7 @@ function! s:Tlist_Process_File(filename, ftype)
2401 2492
                 " Add the tag scope, if it is available and is configured. Tag
2402 2493
                 " scope is the last field after the 'line:<num>\t' field
2403 2494
                 if g:Tlist_Display_Tag_Scope
2404
-                    let tag_scope = s:Tlist_Extract_Tag_Scope(one_line)
2495
+                    let tag_scope = s:Tlist_Get_Tag_Scope(fidx, tidx)
2405 2496
                     if tag_scope != ''
2406 2497
                         let ttxt = ttxt . ' [' . tag_scope . ']'
2407 2498
                     endif
... ...
@@ -2968,7 +3059,7 @@ function! s:Tlist_Change_Sort(caller, action, sort_type)
2968 3059
 
2969 3060
     if a:caller  == 'cmd'
2970 3061
         " Save the current line for later restoration
2971
-        let curline = '\V\^' . getline('.') . '\$'
3062
+        let curline = '\V\^' . escape(getline('.'), "\\") . '\$'
2972 3063
 
2973 3064
         call s:Tlist_Window_Refresh_File(s:tlist_{fidx}_filename,
2974 3065
                     \   s:tlist_{fidx}_filetype)
... ...
@@ -3019,7 +3110,7 @@ function! s:Tlist_Window_Update_File()
3019 3110
     match none
3020 3111
 
3021 3112
     " Save the current line for later restoration
3022
-    let curline = '\V\^' . getline('.') . '\$'
3113
+    let curline = '\V\^' . escape(getline('.'), "\\") . '\$'
3023 3114
 
3024 3115
     let s:tlist_{fidx}_valid = 0
3025 3116
 
... ...
@@ -3210,16 +3301,17 @@ function! s:Tlist_Window_Open_File(win_ctrl, filename, tagpat)
3210 3301
             exe "edit " . escape(a:filename, ' ')
3211 3302
         else
3212 3303
             " Open a new window
3304
+            let cmd_mod = (v:version >= 700) ? 'keepalt ' : ''
3213 3305
             if g:Tlist_Use_Horiz_Window
3214
-                exe 'leftabove split ' . escape(a:filename, ' ')
3306
+                exe cmd_mod . 'leftabove split ' . escape(a:filename, ' ')
3215 3307
             else
3216 3308
                 if winbufnr(2) == -1
3217 3309
                     " Only the taglist window is present
3218 3310
                     if g:Tlist_Use_Right_Window
3219
-                        exe 'leftabove vertical split ' .
3311
+                        exe cmd_mod . 'leftabove vertical split ' .
3220 3312
                                     \ escape(a:filename, ' ')
3221 3313
                     else
3222
-                        exe 'rightbelow vertical split ' .
3314
+                        exe cmd_mod . 'rightbelow vertical split ' .
3223 3315
                                     \ escape(a:filename, ' ')
3224 3316
                     endif
3225 3317
 
... ...
@@ -3236,7 +3328,7 @@ function! s:Tlist_Window_Open_File(win_ctrl, filename, tagpat)
3236 3328
                 else
3237 3329
                     " A plugin or help window is also present
3238 3330
                     wincmd w
3239
-                    exe 'leftabove split ' . escape(a:filename, ' ')
3331
+                    exe cmd_mod . 'leftabove split ' . escape(a:filename, ' ')
3240 3332
                 endif
3241 3333
             endif
3242 3334
         endif
... ...
@@ -3413,7 +3505,8 @@ function! s:Tlist_Window_Show_Info()
3413 3505
     endif
3414 3506
 
3415 3507
     " Get the tag search pattern and display it
3416
-    echo s:Tlist_Get_Tag_Prototype(fidx, tidx)
3508
+    let proto = s:Tlist_Get_Tag_Prototype(fidx, tidx)
3509
+    echo strpart(proto, 0, &columns - 1)
3417 3510
 endfunction
3418 3511
 
3419 3512
 " Tlist_Find_Nearest_Tag_Idx
... ...
@@ -3709,7 +3802,33 @@ function! Tlist_Get_Tagname_By_Line(...)
3709 3802
         return ""
3710 3803
     endif
3711 3804
 
3712
-    return s:tlist_{fidx}_{tidx}_tag_name
3805
+    let name = s:tlist_{fidx}_{tidx}_tag_name
3806
+
3807
+    if g:Tlist_Display_Tag_Scope
3808
+        " Add the scope of the tag
3809
+        let tag_scope = s:tlist_{fidx}_{tidx}_tag_scope
3810
+        if tag_scope != ''
3811
+            let name = name . ' [' . tag_scope . ']'
3812
+        endif
3813
+    endif
3814
+
3815
+    return name
3816
+endfunction
3817
+
3818
+" Tlist_Get_Filenames
3819
+" Return the list of file names in the taglist. The names are separated
3820
+" by a newline ('\n')
3821
+function! Tlist_Get_Filenames()
3822
+    let fnames = ''
3823
+
3824
+    let i = 0
3825
+
3826
+    while i < s:tlist_file_count
3827
+        let fnames = fnames . s:tlist_{i}_filename . "\n"
3828
+        let i = i + 1
3829
+    endwhile
3830
+
3831
+    return fnames
3713 3832
 endfunction
3714 3833
 
3715 3834
 " Tlist_Window_Move_To_File
... ...
@@ -4092,6 +4211,28 @@ function! s:Tlist_Window_Check_Auto_Open()
4092 4211
     endif
4093 4212
 endfunction
4094 4213
 
4214
+" Tlist_Create_Folds_For_File
4215
+" Create the folds in the taglist window for the specified file
4216
+function! s:Tlist_Create_Folds_For_File(fidx)
4217
+    let ftype = s:tlist_{a:fidx}_filetype
4218
+
4219
+    " Create the folds for each tag type in a file
4220
+    let j = 1
4221
+    while j <= s:tlist_{ftype}_count
4222
+        let ttype = s:tlist_{ftype}_{j}_name
4223
+        if s:tlist_{a:fidx}_{ttype}_count
4224
+            let s = s:tlist_{a:fidx}_start + s:tlist_{a:fidx}_{ttype}_offset
4225
+            let e = s + s:tlist_{a:fidx}_{ttype}_count
4226
+            exe s . ',' . e . 'fold'
4227
+        endif
4228
+        let j = j + 1
4229
+    endwhile
4230
+
4231
+    exe s:tlist_{a:fidx}_start . ',' . s:tlist_{a:fidx}_end . 'fold'
4232
+    exe 'silent! ' . s:tlist_{a:fidx}_start . ',' .
4233
+                \ s:tlist_{a:fidx}_end . 'foldopen!'
4234
+endfunction
4235
+
4095 4236
 " Tlist_Refresh_Folds
4096 4237
 " Remove and create the folds for all the files displayed in the taglist
4097 4238
 " window. Used after entering a tab. If this is not done, then the folds
... ...
@@ -4108,28 +4249,18 @@ function! s:Tlist_Refresh_Folds()
4108 4249
     " First remove all the existing folds
4109 4250
     normal! zE
4110 4251
 
4111
-    " Create the folds for each in the tag list
4252
+    if g:Tlist_Show_One_File 
4253
+        " If only one file is displayed in the taglist window, then there
4254
+        " is no need to refresh the folds for the tags as the tags for the
4255
+        " current file will be removed anyway.
4256
+    else
4257
+        " Create the folds for each file in the tag list
4112 4258
         let fidx = 0
4113 4259
         while fidx < s:tlist_file_count
4114
-        let ftype = s:tlist_{fidx}_filetype
4115
-
4116
-        " Create the folds for each tag type in a file
4117
-        let j = 1
4118
-        while j <= s:tlist_{ftype}_count
4119
-            let ttype = s:tlist_{ftype}_{j}_name
4120
-            if s:tlist_{fidx}_{ttype}_count
4121
-                let s = s:tlist_{fidx}_start + s:tlist_{fidx}_{ttype}_offset
4122
-                let e = s + s:tlist_{fidx}_{ttype}_count
4123
-                exe s . ',' . e . 'fold'
4124
-            endif
4125
-            let j = j + 1
4126
-        endwhile
4127
-
4128
-        exe s:tlist_{fidx}_start . ',' . s:tlist_{fidx}_end . 'fold'
4129
-        exe 'silent! ' . s:tlist_{fidx}_start . ',' .
4130
-                    \ s:tlist_{fidx}_end . 'foldopen!'
4260
+            call s:Tlist_Create_Folds_For_File(fidx)
4131 4261
             let fidx = fidx + 1
4132 4262
         endwhile
4263
+    endif
4133 4264
 
4134 4265
     exe save_wnum . 'wincmd w'
4135 4266
 endfunction
4136 4267