summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.1094
blob: 8de51e2ec0d046d309c709c32256245fb12f833f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
To: vim_dev@googlegroups.com
Subject: Patch 8.1.1094
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 8.1.1094
Problem:    Long line in tags file causes error.
Solution:   Check for overlong line earlier. (Andy Massimino, closes #4051,
            closes #4084)
Files:	    src/tag.c, src/testdir/test_tagjump.vim


*** ../vim-8.1.1093/src/tag.c	2019-03-30 21:19:16.426170240 +0100
--- src/tag.c	2019-03-30 21:35:15.693644971 +0100
***************
*** 1921,1926 ****
--- 1921,1952 ----
  	    }
  
  parse_line:
+ 	    if (vim_strchr(lbuf, NL) == NULL
+ #ifdef FEAT_CSCOPE
+ 					     && !use_cscope
+ #endif
+ 					     )
+ 	    {
+ 		// Truncated line, ignore it.  Has been reported for
+ 		// Mozilla JS with extremely long names.
+ 		if (p_verbose >= 5)
+ 		{
+ 		    verbose_enter();
+ 		    msg(_("Ignoring long line in tags file"));
+ 		    verbose_leave();
+ 		}
+ #ifdef FEAT_TAG_BINS
+ 		if (state != TS_LINEAR)
+ 		{
+ 		    // Avoid getting stuck.
+ 		    linear = TRUE;
+ 		    state = TS_LINEAR;
+ 		    vim_fseek(fp, search_info.low_offset, SEEK_SET);
+ 		}
+ #endif
+ 		continue;
+ 	    }
+ 
  	    /*
  	     * Figure out where the different strings are in this line.
  	     * For "normal" tags: Do a quick check if the tag matches.
***************
*** 1937,1964 ****
  		tagp.tagname_end = vim_strchr(lbuf, TAB);
  		if (tagp.tagname_end == NULL)
  		{
- 		    if (vim_strchr(lbuf, NL) == NULL)
- 		    {
- 			/* Truncated line, ignore it.  Has been reported for
- 			 * Mozilla JS with extremely long names. */
- 			if (p_verbose >= 5)
- 			{
- 			    verbose_enter();
- 			    msg(_("Ignoring long line in tags file"));
- 			    verbose_leave();
- 			}
- #ifdef FEAT_TAG_BINS
- 			if (state != TS_LINEAR)
- 			{
- 			    /* Avoid getting stuck. */
- 			    linear = TRUE;
- 			    state = TS_LINEAR;
- 			    vim_fseek(fp, search_info.low_offset, SEEK_SET);
- 			}
- #endif
- 			continue;
- 		    }
- 
  		    /* Corrupted tag line. */
  		    line_error = TRUE;
  		    break;
--- 1963,1968 ----
*** ../vim-8.1.1093/src/testdir/test_tagjump.vim	2019-03-30 19:11:58.530574234 +0100
--- src/testdir/test_tagjump.vim	2019-03-30 21:33:21.530692816 +0100
***************
*** 439,442 ****
--- 439,473 ----
    call delete('Xtest.c')
  endfunc
  
+ func Test_tag_line_toolong()
+   call writefile([
+ 	\ '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678	django/contrib/admin/templates/admin/edit_inline/stacked.html	16;"	j	line:16	language:HTML'
+ 	\ ], 'Xtags')
+   set tags=Xtags
+   let old_vbs = &verbose
+   set verbose=5
+   " ":tjump" should give "tag not found" not "Format error in tags file"
+   call assert_fails('tj /foo', 'E426')
+   try
+     tj /foo
+   catch /^Vim\%((\a\+)\)\=:E431/
+     call assert_report(v:exception)
+   catch /.*/
+   endtry
+   call assert_equal('Ignoring long line in tags file', split(execute('messages'), '\n')[-1])
+   call writefile([
+ 	\ '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567	django/contrib/admin/templates/admin/edit_inline/stacked.html	16;"	j	line:16	language:HTML'
+ 	\ ], 'Xtags')
+   call assert_fails('tj /foo', 'E426')
+   try
+     tj /foo
+   catch /^Vim\%((\a\+)\)\=:E431/
+     call assert_report(v:exception)
+   catch /.*/
+   endtry
+   call assert_equal('Ignoring long line in tags file', split(execute('messages'), '\n')[-1])
+   call delete('Xtags')
+   let &verbose = old_vbs
+ endfunc
+ 
  " vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.1.1093/src/version.c	2019-03-30 21:19:16.430170210 +0100
--- src/version.c	2019-03-30 21:33:49.938428730 +0100
***************
*** 773,774 ****
--- 773,776 ----
  {   /* Add new patch number below this line */
+ /**/
+     1094,
  /**/

-- 
"Hit any key to continue" is very confusing when you have two keyboards.

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///