summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.0859
blob: 47d9d6a7bd5600f8769ce753a5421c9549eed54c (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
142
143
144
145
146
147
148
149
150
151
152
153
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0859
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.0859
Problem:    "%v" in 'errorformat' does handle multi-byte characters.
Solution:   Handle multi-byte characters. (Yegappan Lakshmanan, closes #3700)
Files:	    src/quickfix.c, src/testdir/test_quickfix.vim


*** ../vim-8.1.0858/src/quickfix.c	2019-01-26 17:43:16.226527267 +0100
--- src/quickfix.c	2019-01-31 14:24:27.575216468 +0100
***************
*** 3047,3055 ****
  	char_u		*qf_pattern)
  {
      linenr_T		i;
-     char_u		*line;
-     colnr_T		screen_col;
-     colnr_T		char_col;
  
      if (qf_pattern == NULL)
      {
--- 3047,3052 ----
***************
*** 3063,3091 ****
  	}
  	if (qf_col > 0)
  	{
- 	    curwin->w_cursor.col = qf_col - 1;
  	    curwin->w_cursor.coladd = 0;
  	    if (qf_viscol == TRUE)
! 	    {
! 		// Check each character from the beginning of the error
! 		// line up to the error column.  For each tab character
! 		// found, reduce the error column value by the length of
! 		// a tab character.
! 		line = ml_get_curline();
! 		screen_col = 0;
! 		for (char_col = 0; char_col < curwin->w_cursor.col; ++char_col)
! 		{
! 		    if (*line == NUL)
! 			break;
! 		    if (*line++ == '\t')
! 		    {
! 			curwin->w_cursor.col -= 7 - (screen_col % 8);
! 			screen_col += 8 - (screen_col % 8);
! 		    }
! 		    else
! 			++screen_col;
! 		}
! 	    }
  	    curwin->w_set_curswant = TRUE;
  	    check_cursor();
  	}
--- 3060,3070 ----
  	}
  	if (qf_col > 0)
  	{
  	    curwin->w_cursor.coladd = 0;
  	    if (qf_viscol == TRUE)
! 		coladvance(qf_col - 1);
! 	    else
! 		curwin->w_cursor.col = qf_col - 1;
  	    curwin->w_set_curswant = TRUE;
  	    check_cursor();
  	}
*** ../vim-8.1.0858/src/testdir/test_quickfix.vim	2019-01-11 14:49:25.380107431 +0100
--- src/testdir/test_quickfix.vim	2019-01-31 14:26:43.042269859 +0100
***************
*** 3843,3845 ****
--- 3843,3901 ----
    call delete('Xtestfile1')
    call delete('Xtestfile2')
  endfunc
+ 
+ " Test for parsing entries using visual screen column
+ func Test_viscol()
+   enew
+   call writefile(["Col1\tCol2\tCol3"], 'Xfile1')
+   edit Xfile1
+ 
+   " Use byte offset for column number
+   set efm&
+   cexpr "Xfile1:1:5:XX\nXfile1:1:9:YY\nXfile1:1:20:ZZ"
+   call assert_equal([5, 8], [col('.'), virtcol('.')])
+   cnext
+   call assert_equal([9, 12], [col('.'), virtcol('.')])
+   cnext
+   call assert_equal([14, 20], [col('.'), virtcol('.')])
+ 
+   " Use screen column offset for column number
+   set efm=%f:%l:%v:%m
+   cexpr "Xfile1:1:8:XX\nXfile1:1:12:YY\nXfile1:1:20:ZZ"
+   call assert_equal([5, 8], [col('.'), virtcol('.')])
+   cnext
+   call assert_equal([9, 12], [col('.'), virtcol('.')])
+   cnext
+   call assert_equal([14, 20], [col('.'), virtcol('.')])
+   cexpr "Xfile1:1:6:XX\nXfile1:1:15:YY\nXfile1:1:24:ZZ"
+   call assert_equal([5, 8], [col('.'), virtcol('.')])
+   cnext
+   call assert_equal([10, 16], [col('.'), virtcol('.')])
+   cnext
+   call assert_equal([14, 20], [col('.'), virtcol('.')])
+ 
+   enew
+   call writefile(["Col1\täü\töß\tCol4"], 'Xfile1')
+ 
+   " Use byte offset for column number
+   set efm&
+   cexpr "Xfile1:1:8:XX\nXfile1:1:11:YY\nXfile1:1:16:ZZ"
+   call assert_equal([8, 10], [col('.'), virtcol('.')])
+   cnext
+   call assert_equal([11, 17], [col('.'), virtcol('.')])
+   cnext
+   call assert_equal([16, 25], [col('.'), virtcol('.')])
+ 
+   " Use screen column offset for column number
+   set efm=%f:%l:%v:%m
+   cexpr "Xfile1:1:10:XX\nXfile1:1:17:YY\nXfile1:1:25:ZZ"
+   call assert_equal([8, 10], [col('.'), virtcol('.')])
+   cnext
+   call assert_equal([11, 17], [col('.'), virtcol('.')])
+   cnext
+   call assert_equal([16, 25], [col('.'), virtcol('.')])
+ 
+   enew | only
+   set efm&
+   call delete('Xfile1')
+ endfunc
*** ../vim-8.1.0858/src/version.c	2019-01-31 14:12:52.760076333 +0100
--- src/version.c	2019-01-31 14:22:32.848018305 +0100
***************
*** 785,786 ****
--- 785,788 ----
  {   /* Add new patch number below this line */
+ /**/
+     859,
  /**/

-- 
There are 10 kinds of people: Those who understand binary and those who don't.

 /// 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    ///