]>
Commit | Line | Data |
---|---|---|
520747ef | 1 | To: vim_dev@googlegroups.com |
2 | Subject: Patch 7.3.251 | |
3 | Fcc: outbox | |
4 | From: Bram Moolenaar <Bram@moolenaar.net> | |
5 | Mime-Version: 1.0 | |
6 | Content-Type: text/plain; charset=UTF-8 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ------------ | |
9 | ||
10 | Patch 7.3.251 | |
11 | Problem: "gH<Del>" deletes the current line, except when it's the last | |
12 | line. | |
13 | Solution: Set the "include" flag to indicate the last line is to be deleted. | |
14 | Files: src/normal.c, src/ops.c | |
15 | ||
16 | ||
17 | *** ../vim-7.3.250/src/normal.c 2011-07-07 15:08:53.000000000 +0200 | |
18 | --- src/normal.c 2011-07-15 16:53:12.000000000 +0200 | |
19 | *************** | |
20 | *** 1795,1811 **** | |
21 | { | |
22 | oap->inclusive = FALSE; | |
23 | /* Try to include the newline, unless it's an operator | |
24 | ! * that works on lines only */ | |
25 | ! if (*p_sel != 'o' | |
26 | ! && !op_on_lines(oap->op_type) | |
27 | ! && oap->end.lnum < curbuf->b_ml.ml_line_count) | |
28 | { | |
29 | ! ++oap->end.lnum; | |
30 | ! oap->end.col = 0; | |
31 | # ifdef FEAT_VIRTUALEDIT | |
32 | ! oap->end.coladd = 0; | |
33 | # endif | |
34 | ! ++oap->line_count; | |
35 | } | |
36 | } | |
37 | } | |
38 | --- 1795,1819 ---- | |
39 | { | |
40 | oap->inclusive = FALSE; | |
41 | /* Try to include the newline, unless it's an operator | |
42 | ! * that works on lines only. */ | |
43 | ! if (*p_sel != 'o' && !op_on_lines(oap->op_type)) | |
44 | { | |
45 | ! if (oap->end.lnum < curbuf->b_ml.ml_line_count) | |
46 | ! { | |
47 | ! ++oap->end.lnum; | |
48 | ! oap->end.col = 0; | |
49 | # ifdef FEAT_VIRTUALEDIT | |
50 | ! oap->end.coladd = 0; | |
51 | # endif | |
52 | ! ++oap->line_count; | |
53 | ! } | |
54 | ! else | |
55 | ! { | |
56 | ! /* Cannot move below the last line, make the op | |
57 | ! * inclusive to tell the operation to include the | |
58 | ! * line break. */ | |
59 | ! oap->inclusive = TRUE; | |
60 | ! } | |
61 | } | |
62 | } | |
63 | } | |
64 | *** ../vim-7.3.250/src/ops.c 2011-06-19 01:14:22.000000000 +0200 | |
65 | --- src/ops.c 2011-07-15 17:28:28.000000000 +0200 | |
66 | *************** | |
67 | *** 1650,1656 **** | |
68 | && oap->line_count > 1 | |
69 | && oap->op_type == OP_DELETE) | |
70 | { | |
71 | ! ptr = ml_get(oap->end.lnum) + oap->end.col + oap->inclusive; | |
72 | ptr = skipwhite(ptr); | |
73 | if (*ptr == NUL && inindent(0)) | |
74 | oap->motion_type = MLINE; | |
75 | --- 1650,1658 ---- | |
76 | && oap->line_count > 1 | |
77 | && oap->op_type == OP_DELETE) | |
78 | { | |
79 | ! ptr = ml_get(oap->end.lnum) + oap->end.col; | |
80 | ! if (*ptr != NUL) | |
81 | ! ptr += oap->inclusive; | |
82 | ptr = skipwhite(ptr); | |
83 | if (*ptr == NUL && inindent(0)) | |
84 | oap->motion_type = MLINE; | |
85 | *************** | |
86 | *** 1920,1930 **** | |
87 | curwin->w_cursor.coladd = 0; | |
88 | } | |
89 | #endif | |
90 | ! (void)del_bytes((long)n, !virtual_op, oap->op_type == OP_DELETE | |
91 | #ifdef FEAT_VISUAL | |
92 | && !oap->is_VIsual | |
93 | #endif | |
94 | ); | |
95 | } | |
96 | else /* delete characters between lines */ | |
97 | { | |
98 | --- 1922,1941 ---- | |
99 | curwin->w_cursor.coladd = 0; | |
100 | } | |
101 | #endif | |
102 | ! if (oap->inclusive && oap->end.lnum == curbuf->b_ml.ml_line_count | |
103 | ! && n > (int)STRLEN(ml_get(oap->end.lnum))) | |
104 | ! { | |
105 | ! /* Special case: gH<Del> deletes the last line. */ | |
106 | ! del_lines(1L, FALSE); | |
107 | ! } | |
108 | ! else | |
109 | ! { | |
110 | ! (void)del_bytes((long)n, !virtual_op, oap->op_type == OP_DELETE | |
111 | #ifdef FEAT_VISUAL | |
112 | && !oap->is_VIsual | |
113 | #endif | |
114 | ); | |
115 | + } | |
116 | } | |
117 | else /* delete characters between lines */ | |
118 | { | |
119 | *************** | |
120 | *** 1941,1957 **** | |
121 | ++curwin->w_cursor.lnum; | |
122 | del_lines((long)(oap->line_count - 2), FALSE); | |
123 | ||
124 | ! /* delete from start of line until op_end */ | |
125 | ! curwin->w_cursor.col = 0; | |
126 | ! (void)del_bytes((long)(oap->end.col + 1 - !oap->inclusive), | |
127 | ! !virtual_op, oap->op_type == OP_DELETE | |
128 | #ifdef FEAT_VISUAL | |
129 | && !oap->is_VIsual | |
130 | #endif | |
131 | ); | |
132 | ! curwin->w_cursor = curpos; /* restore curwin->w_cursor */ | |
133 | ! | |
134 | ! (void)do_join(2, FALSE, FALSE); | |
135 | } | |
136 | } | |
137 | ||
138 | --- 1952,1980 ---- | |
139 | ++curwin->w_cursor.lnum; | |
140 | del_lines((long)(oap->line_count - 2), FALSE); | |
141 | ||
142 | ! n = (oap->end.col + 1 - !oap->inclusive); | |
143 | ! if (oap->inclusive && oap->end.lnum == curbuf->b_ml.ml_line_count | |
144 | ! && n > (int)STRLEN(ml_get(oap->end.lnum))) | |
145 | ! { | |
146 | ! /* Special case: gH<Del> deletes the last line. */ | |
147 | ! del_lines(1L, FALSE); | |
148 | ! curwin->w_cursor = curpos; /* restore curwin->w_cursor */ | |
149 | ! if (curwin->w_cursor.lnum > 1) | |
150 | ! --curwin->w_cursor.lnum; | |
151 | ! } | |
152 | ! else | |
153 | ! { | |
154 | ! /* delete from start of line until op_end */ | |
155 | ! curwin->w_cursor.col = 0; | |
156 | ! (void)del_bytes((long)n, !virtual_op, oap->op_type == OP_DELETE | |
157 | #ifdef FEAT_VISUAL | |
158 | && !oap->is_VIsual | |
159 | #endif | |
160 | ); | |
161 | ! curwin->w_cursor = curpos; /* restore curwin->w_cursor */ | |
162 | ! } | |
163 | ! if (curwin->w_cursor.lnum < curbuf->b_ml.ml_line_count) | |
164 | ! (void)do_join(2, FALSE, FALSE); | |
165 | } | |
166 | } | |
167 | ||
168 | *** ../vim-7.3.250/src/version.c 2011-07-15 15:54:39.000000000 +0200 | |
169 | --- src/version.c 2011-07-15 17:35:18.000000000 +0200 | |
170 | *************** | |
171 | *** 711,712 **** | |
172 | --- 711,714 ---- | |
173 | { /* Add new patch number below this line */ | |
174 | + /**/ | |
175 | + 251, | |
176 | /**/ | |
177 | ||
178 | -- | |
179 | ### Hiroshima 45, Chernobyl 86, Windows 95 ### | |
180 | ||
181 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
182 | /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
183 | \\\ an exciting new programming language -- http://www.Zimbu.org /// | |
184 | \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |