]>
Commit | Line | Data |
---|---|---|
ef75664d AG |
1 | To: vim-dev@vim.org |
2 | Subject: Patch 7.1.258 | |
3 | Fcc: outbox | |
4 | From: Bram Moolenaar <Bram@moolenaar.net> | |
5 | Mime-Version: 1.0 | |
6 | Content-Type: text/plain; charset=ISO-8859-1 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ------------ | |
9 | ||
10 | Patch 7.1.258 | |
11 | Problem: Crash when doing "d/\n/e" and 'virtualedit' is "all". (Andy Wokula) | |
12 | Solution: Avoid that the column becomes negative. Also fixes other problems | |
13 | with the end of a pattern match is in column zero. (A.Politz) | |
14 | Files: src/search.c | |
15 | ||
16 | ||
17 | *** ../vim-7.1.257/src/search.c Sat Jan 26 21:15:00 2008 | |
18 | --- src/search.c Wed Feb 20 13:22:23 2008 | |
19 | *************** | |
20 | *** 624,630 **** | |
21 | #ifdef FEAT_EVAL | |
22 | submatch = first_submatch(®match); | |
23 | #endif | |
24 | ! /* Line me be past end of buffer for "\n\zs". */ | |
25 | if (lnum + matchpos.lnum > buf->b_ml.ml_line_count) | |
26 | ptr = (char_u *)""; | |
27 | else | |
28 | --- 624,630 ---- | |
29 | #ifdef FEAT_EVAL | |
30 | submatch = first_submatch(®match); | |
31 | #endif | |
32 | ! /* "lnum" may be past end of buffer for "\n\zs". */ | |
33 | if (lnum + matchpos.lnum > buf->b_ml.ml_line_count) | |
34 | ptr = (char_u *)""; | |
35 | else | |
36 | *************** | |
37 | *** 833,853 **** | |
38 | continue; | |
39 | } | |
40 | ||
41 | ! if (options & SEARCH_END && !(options & SEARCH_NOOF)) | |
42 | { | |
43 | pos->lnum = lnum + endpos.lnum; | |
44 | ! pos->col = endpos.col - 1; | |
45 | ! #ifdef FEAT_MBYTE | |
46 | ! if (has_mbyte) | |
47 | { | |
48 | ! /* 'e' offset may put us just below the last line */ | |
49 | ! if (pos->lnum > buf->b_ml.ml_line_count) | |
50 | ! ptr = (char_u *)""; | |
51 | ! else | |
52 | ! ptr = ml_get_buf(buf, pos->lnum, FALSE); | |
53 | ! pos->col -= (*mb_head_off)(ptr, ptr + pos->col); | |
54 | } | |
55 | #endif | |
56 | } | |
57 | else | |
58 | { | |
59 | --- 833,870 ---- | |
60 | continue; | |
61 | } | |
62 | ||
63 | ! /* With the SEARCH_END option move to the last character | |
64 | ! * of the match. Don't do it for an empty match, end | |
65 | ! * should be same as start then. */ | |
66 | ! if (options & SEARCH_END && !(options & SEARCH_NOOF) | |
67 | ! && !(matchpos.lnum == endpos.lnum | |
68 | ! && matchpos.col == endpos.col)) | |
69 | { | |
70 | + /* For a match in the first column, set the position | |
71 | + * on the NUL in the previous line. */ | |
72 | pos->lnum = lnum + endpos.lnum; | |
73 | ! pos->col = endpos.col; | |
74 | ! if (endpos.col == 0) | |
75 | { | |
76 | ! if (pos->lnum > 1) /* just in case */ | |
77 | ! { | |
78 | ! --pos->lnum; | |
79 | ! pos->col = (colnr_T)STRLEN(ml_get_buf(buf, | |
80 | ! pos->lnum, FALSE)); | |
81 | ! } | |
82 | } | |
83 | + else | |
84 | + { | |
85 | + --pos->col; | |
86 | + #ifdef FEAT_MBYTE | |
87 | + if (has_mbyte | |
88 | + && pos->lnum <= buf->b_ml.ml_line_count) | |
89 | + { | |
90 | + ptr = ml_get_buf(buf, pos->lnum, FALSE); | |
91 | + pos->col -= (*mb_head_off)(ptr, ptr + pos->col); | |
92 | + } | |
93 | #endif | |
94 | + } | |
95 | } | |
96 | else | |
97 | { | |
98 | *** ../vim-7.1.257/src/version.c Wed Feb 20 12:43:05 2008 | |
99 | --- src/version.c Wed Feb 20 13:37:32 2008 | |
100 | *************** | |
101 | *** 668,669 **** | |
102 | --- 668,671 ---- | |
103 | { /* Add new patch number below this line */ | |
104 | + /**/ | |
105 | + 258, | |
106 | /**/ | |
107 | ||
108 | -- | |
109 | Micro$oft: where do you want to go today? | |
110 | Linux: where do you want to go tomorrow? | |
111 | FreeBSD: are you guys coming, or what? | |
112 | ||
113 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
114 | /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
115 | \\\ download, build and distribute -- http://www.A-A-P.org /// | |
116 | \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |