]>
Commit | Line | Data |
---|---|---|
d02ad552 AG |
1 | To: vim-dev@vim.org |
2 | Subject: Patch 6.2.208 | |
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 6.2.208 | |
11 | Problem: When using fold markers, three lines in a row have the start | |
12 | marker and deleting the first one with "dd", a nested fold is not | |
13 | deleted. (Kamil Burzynski) | |
14 | Using marker folding, a level 1 fold doesn't stop when it is | |
15 | followed by "{{{2", starting a level 2 fold. | |
16 | Solution: Don't stop updating folds at the end of a change when the nesting | |
17 | level of folds is larger than the fold level. | |
18 | Correctly compute the number of folds that start at "{{{2". | |
19 | Also avoid a crash for a NULL pointer. | |
20 | Files: src/fold.c | |
21 | ||
22 | ||
23 | *** ../vim-6.2.207/src/fold.c Mon Dec 29 20:30:12 2003 | |
24 | --- src/fold.c Sat Jan 24 17:01:17 2004 | |
25 | *************** | |
26 | *** 2262,2270 **** | |
27 | && getlevel != foldlevelExpr | |
28 | && getlevel != foldlevelSyntax) | |
29 | break; | |
30 | ! if (lvl == level | |
31 | ! && foldFind(&fp->fd_nested, flp->lnum - fp->fd_top, &fp2)) | |
32 | ! bot = fp2->fd_top + fp2->fd_len - 1 + fp->fd_top; | |
33 | else if (fp->fd_top + fp->fd_len <= flp->lnum && lvl >= level) | |
34 | finish = TRUE; | |
35 | else | |
36 | --- 2262,2287 ---- | |
37 | && getlevel != foldlevelExpr | |
38 | && getlevel != foldlevelSyntax) | |
39 | break; | |
40 | ! i = 0; | |
41 | ! fp2 = fp; | |
42 | ! if (lvl >= level) | |
43 | ! { | |
44 | ! /* Compute how deep the folds currently are, if it's deeper | |
45 | ! * than "lvl" then some must be deleted, need to update | |
46 | ! * at least one nested fold. */ | |
47 | ! ll = flp->lnum - fp->fd_top; | |
48 | ! while (foldFind(&fp2->fd_nested, ll, &fp2)) | |
49 | ! { | |
50 | ! ++i; | |
51 | ! ll -= fp2->fd_top; | |
52 | ! } | |
53 | ! } | |
54 | ! if (lvl < level + i) | |
55 | ! { | |
56 | ! foldFind(&fp->fd_nested, flp->lnum - fp->fd_top, &fp2); | |
57 | ! if (fp2 != NULL) | |
58 | ! bot = fp2->fd_top + fp2->fd_len - 1 + fp->fd_top; | |
59 | ! } | |
60 | else if (fp->fd_top + fp->fd_len <= flp->lnum && lvl >= level) | |
61 | finish = TRUE; | |
62 | else | |
63 | *************** | |
64 | *** 2959,2964 **** | |
65 | --- 2976,2982 ---- | |
66 | char_u *startmarker; | |
67 | int cstart; | |
68 | int cend; | |
69 | + int start_lvl = flp->lvl; | |
70 | char_u *s; | |
71 | int n; | |
72 | ||
73 | *************** | |
74 | *** 2987,2993 **** | |
75 | { | |
76 | flp->lvl = n; | |
77 | flp->lvl_next = n; | |
78 | ! ++flp->start; | |
79 | } | |
80 | } | |
81 | else | |
82 | --- 3005,3014 ---- | |
83 | { | |
84 | flp->lvl = n; | |
85 | flp->lvl_next = n; | |
86 | ! if (n < start_lvl) | |
87 | ! flp->start = 0; | |
88 | ! else | |
89 | ! flp->start = n - start_lvl; | |
90 | } | |
91 | } | |
92 | else | |
93 | *************** | |
94 | *** 3036,3042 **** | |
95 | fline_T *flp; | |
96 | { | |
97 | #ifndef FEAT_SYN_HL | |
98 | ! flp->start = FALSE; | |
99 | flp->lvl = 0; | |
100 | #else | |
101 | linenr_T lnum = flp->lnum + flp->off; | |
102 | --- 3057,3063 ---- | |
103 | fline_T *flp; | |
104 | { | |
105 | #ifndef FEAT_SYN_HL | |
106 | ! flp->start = 0; | |
107 | flp->lvl = 0; | |
108 | #else | |
109 | linenr_T lnum = flp->lnum + flp->off; | |
110 | *************** | |
111 | *** 3044,3050 **** | |
112 | ||
113 | /* Use the maximum fold level at the start of this line and the next. */ | |
114 | flp->lvl = syn_get_foldlevel(flp->wp, lnum); | |
115 | ! flp->start = FALSE; | |
116 | if (lnum < flp->wp->w_buffer->b_ml.ml_line_count) | |
117 | { | |
118 | n = syn_get_foldlevel(flp->wp, lnum + 1); | |
119 | --- 3065,3071 ---- | |
120 | ||
121 | /* Use the maximum fold level at the start of this line and the next. */ | |
122 | flp->lvl = syn_get_foldlevel(flp->wp, lnum); | |
123 | ! flp->start = 0; | |
124 | if (lnum < flp->wp->w_buffer->b_ml.ml_line_count) | |
125 | { | |
126 | n = syn_get_foldlevel(flp->wp, lnum + 1); | |
127 | *** ../vim-6.2.207/src/version.c Sun Jan 25 20:30:03 2004 | |
128 | --- src/version.c Sun Jan 25 20:32:00 2004 | |
129 | *************** | |
130 | *** 639,640 **** | |
131 | --- 639,642 ---- | |
132 | { /* Add new patch number below this line */ | |
133 | + /**/ | |
134 | + 208, | |
135 | /**/ | |
136 | ||
137 | -- | |
138 | JOHN CLEESE PLAYED: SECOND SOLDIER WITH A KEEN INTEREST IN BIRDS, LARGE MAN | |
139 | WITH DEAD BODY, BLACK KNIGHT, MR NEWT (A VILLAGE | |
140 | BLACKSMITH INTERESTED IN BURNING WITCHES), A QUITE | |
141 | EXTRAORDINARILY RUDE FRENCHMAN, TIM THE WIZARD, SIR | |
142 | LAUNCELOT | |
143 | "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD | |
144 | ||
145 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
146 | /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
147 | \\\ Project leader for A-A-P -- http://www.A-A-P.org /// | |
148 | \\\ Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html /// |