-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmb_patch.txt
159 lines (146 loc) · 3.59 KB
/
mb_patch.txt
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
154
155
156
157
*** src/search.c.orig Tue Jul 18 08:44:08 2006
--- src/search.c Tue Jul 18 08:55:22 2006
***************
*** 1286,1294 ****
--- 1286,1296 ----
/* to the left, check for start of file */
else
{
+ #ifndef FEAT_MBYTE
if ((c = pos.col + spats[0].off.off) >= 0)
pos.col = c;
else
+ #endif
for (c = spats[0].off.off; c; ++c)
if (decl(&pos) == -1)
break;
*** src/syntax.c.orig Tue Jul 18 07:51:49 2006
--- src/syntax.c Tue Jul 18 18:33:05 2006
***************
*** 2965,2998 ****
int extra; /* extra chars for offset to start */
{
int col;
! int len;
if (spp->sp_off_flags & (1 << idx))
{
result->lnum = regmatch->startpos[0].lnum;
! col = regmatch->startpos[0].col + extra;
}
else
{
result->lnum = regmatch->endpos[0].lnum;
col = regmatch->endpos[0].col;
}
! col += spp->sp_offsets[idx];
! if (col < 0)
! result->col = 0;
! else
{
! /* Don't go past the end of the line. Matters for "rs=e+2" when there
! * is a matchgroup. Watch out for match with last NL in the buffer. */
! if (result->lnum > syn_buf->b_ml.ml_line_count)
! len = 0;
! else
! len = (int)STRLEN(ml_get_buf(syn_buf, result->lnum, FALSE));
! if (col > len)
! result->col = len;
! else
! result->col = col;
}
}
/*
--- 2965,3003 ----
int extra; /* extra chars for offset to start */
{
int col;
! int off;
! char_u *base;
! char_u *p;
if (spp->sp_off_flags & (1 << idx))
{
result->lnum = regmatch->startpos[0].lnum;
! col = regmatch->startpos[0].col;
! off = spp->sp_offsets[idx] + extra;
}
else
{
result->lnum = regmatch->endpos[0].lnum;
col = regmatch->endpos[0].col;
+ off = spp->sp_offsets[idx];
}
! /* Don't go past the end of the line. Matters for "rs=e+2" when there
! * is a matchgroup. Watch out for match with last NL in the buffer. */
! if (result->lnum > syn_buf->b_ml.ml_line_count)
! col = 0;
! else if (off != 0)
{
! base = ml_get_buf(syn_buf, result->lnum, FALSE);
! p = base + col;
! if (off > 0)
! while (off-- && *p != NUL)
! mb_ptr_adv(p);
! else if (off < 0)
! while (off++ && base < p)
! mb_ptr_back(base, p);
! col = (int)(p - base);
}
+ result->col = col;
}
/*
***************
*** 3008,3029 ****
int extra; /* extra chars for offset to end */
{
int col;
if (spp->sp_off_flags & (1 << (idx + SPO_COUNT)))
{
result->lnum = regmatch->endpos[0].lnum;
! col = regmatch->endpos[0].col + extra;
}
else
{
result->lnum = regmatch->startpos[0].lnum;
col = regmatch->startpos[0].col;
}
! col += spp->sp_offsets[idx];
! if (col < 0)
! result->col = 0;
! else
! result->col = col;
}
/*
--- 3013,3047 ----
int extra; /* extra chars for offset to end */
{
int col;
+ int off;
+ char_u *base;
+ char_u *p;
if (spp->sp_off_flags & (1 << (idx + SPO_COUNT)))
{
result->lnum = regmatch->endpos[0].lnum;
! col = regmatch->endpos[0].col;
! off = spp->sp_offsets[idx] + extra;
}
else
{
result->lnum = regmatch->startpos[0].lnum;
col = regmatch->startpos[0].col;
+ off = spp->sp_offsets[idx];
}
! if (off != 0)
! {
! base = ml_get_buf(syn_buf, result->lnum, FALSE);
! p = base + col;
! if (off > 0)
! while (off-- && *p != NUL)
! mb_ptr_adv(p);
! else if (off < 0)
! while (off++ && base < p)
! mb_ptr_back(base, p);
! col = (int)(p - base);
! }
! result->col = col;
}
/*