]>
Commit | Line | Data |
---|---|---|
d2415672 AG |
1 | To: vim-dev@vim.org |
2 | Subject: Patch 7.1.175 | |
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.175 | |
11 | Problem: <BS> doesn't work with some combination of 'sts', 'linebreak' and | |
12 | 'backspace'. (Francois Ingelrest) | |
13 | Solution: When adding white space results in not moving back delete one | |
14 | character. | |
15 | Files: src/edit.c | |
16 | ||
17 | ||
18 | *** ../vim-7.1.174/src/edit.c Sat Nov 24 21:27:33 2007 | |
19 | --- src/edit.c Fri Dec 7 21:32:48 2007 | |
20 | *************** | |
21 | *** 8189,8194 **** | |
22 | --- 8189,8217 ---- | |
23 | AppendCharToRedobuff(K_DEL); | |
24 | } | |
25 | ||
26 | + static void ins_bs_one __ARGS((colnr_T *vcolp)); | |
27 | + | |
28 | + /* | |
29 | + * Delete one character for ins_bs(). | |
30 | + */ | |
31 | + static void | |
32 | + ins_bs_one(vcolp) | |
33 | + colnr_T *vcolp; | |
34 | + { | |
35 | + dec_cursor(); | |
36 | + getvcol(curwin, &curwin->w_cursor, vcolp, NULL, NULL); | |
37 | + if (State & REPLACE_FLAG) | |
38 | + { | |
39 | + /* Don't delete characters before the insert point when in | |
40 | + * Replace mode */ | |
41 | + if (curwin->w_cursor.lnum != Insstart.lnum | |
42 | + || curwin->w_cursor.col >= Insstart.col) | |
43 | + replace_do_bs(); | |
44 | + } | |
45 | + else | |
46 | + (void)del_char(FALSE); | |
47 | + } | |
48 | + | |
49 | /* | |
50 | * Handle Backspace, delete-word and delete-line in Insert mode. | |
51 | * Return TRUE when backspace was actually used. | |
52 | *************** | |
53 | *** 8418,8426 **** | |
54 | int ts; | |
55 | colnr_T vcol; | |
56 | colnr_T want_vcol; | |
57 | ! #if 0 | |
58 | ! int extra = 0; | |
59 | ! #endif | |
60 | ||
61 | *inserted_space_p = FALSE; | |
62 | if (p_sta && in_indent) | |
63 | --- 8441,8447 ---- | |
64 | int ts; | |
65 | colnr_T vcol; | |
66 | colnr_T want_vcol; | |
67 | ! colnr_T start_vcol; | |
68 | ||
69 | *inserted_space_p = FALSE; | |
70 | if (p_sta && in_indent) | |
71 | *************** | |
72 | *** 8431,8436 **** | |
73 | --- 8452,8458 ---- | |
74 | * 'showbreak' may get in the way, need to get the last column of | |
75 | * the previous character. */ | |
76 | getvcol(curwin, &curwin->w_cursor, &vcol, NULL, NULL); | |
77 | + start_vcol = vcol; | |
78 | dec_cursor(); | |
79 | getvcol(curwin, &curwin->w_cursor, NULL, NULL, &want_vcol); | |
80 | inc_cursor(); | |
81 | *************** | |
82 | *** 8439,8468 **** | |
83 | /* delete characters until we are at or before want_vcol */ | |
84 | while (vcol > want_vcol | |
85 | && (cc = *(ml_get_cursor() - 1), vim_iswhite(cc))) | |
86 | ! { | |
87 | ! dec_cursor(); | |
88 | ! getvcol(curwin, &curwin->w_cursor, &vcol, NULL, NULL); | |
89 | ! if (State & REPLACE_FLAG) | |
90 | ! { | |
91 | ! /* Don't delete characters before the insert point when in | |
92 | ! * Replace mode */ | |
93 | ! if (curwin->w_cursor.lnum != Insstart.lnum | |
94 | ! || curwin->w_cursor.col >= Insstart.col) | |
95 | ! { | |
96 | ! #if 0 /* what was this for? It causes problems when sw != ts. */ | |
97 | ! if (State == REPLACE && (int)vcol < want_vcol) | |
98 | ! { | |
99 | ! (void)del_char(FALSE); | |
100 | ! extra = 2; /* don't pop too much */ | |
101 | ! } | |
102 | ! else | |
103 | ! #endif | |
104 | ! replace_do_bs(); | |
105 | ! } | |
106 | ! } | |
107 | ! else | |
108 | ! (void)del_char(FALSE); | |
109 | ! } | |
110 | ||
111 | /* insert extra spaces until we are at want_vcol */ | |
112 | while (vcol < want_vcol) | |
113 | --- 8461,8467 ---- | |
114 | /* delete characters until we are at or before want_vcol */ | |
115 | while (vcol > want_vcol | |
116 | && (cc = *(ml_get_cursor() - 1), vim_iswhite(cc))) | |
117 | ! ins_bs_one(&vcol); | |
118 | ||
119 | /* insert extra spaces until we are at want_vcol */ | |
120 | while (vcol < want_vcol) | |
121 | *************** | |
122 | *** 8479,8500 **** | |
123 | #endif | |
124 | { | |
125 | ins_str((char_u *)" "); | |
126 | ! if ((State & REPLACE_FLAG) /* && extra <= 1 */) | |
127 | ! { | |
128 | ! #if 0 | |
129 | ! if (extra) | |
130 | ! replace_push_off(NUL); | |
131 | ! else | |
132 | ! #endif | |
133 | ! replace_push(NUL); | |
134 | ! } | |
135 | ! #if 0 | |
136 | ! if (extra == 2) | |
137 | ! extra = 1; | |
138 | ! #endif | |
139 | } | |
140 | getvcol(curwin, &curwin->w_cursor, &vcol, NULL, NULL); | |
141 | } | |
142 | } | |
143 | ||
144 | /* | |
145 | --- 8478,8493 ---- | |
146 | #endif | |
147 | { | |
148 | ins_str((char_u *)" "); | |
149 | ! if ((State & REPLACE_FLAG)) | |
150 | ! replace_push(NUL); | |
151 | } | |
152 | getvcol(curwin, &curwin->w_cursor, &vcol, NULL, NULL); | |
153 | } | |
154 | + | |
155 | + /* If we are now back where we started delete one character. Can | |
156 | + * happen when using 'sts' and 'linebreak'. */ | |
157 | + if (vcol >= start_vcol) | |
158 | + ins_bs_one(&vcol); | |
159 | } | |
160 | ||
161 | /* | |
162 | *** ../vim-7.1.174/src/version.c Sun Dec 9 19:37:37 2007 | |
163 | --- src/version.c Sun Dec 9 20:24:11 2007 | |
164 | *************** | |
165 | *** 668,669 **** | |
166 | --- 668,671 ---- | |
167 | { /* Add new patch number below this line */ | |
168 | + /**/ | |
169 | + 175, | |
170 | /**/ | |
171 | ||
172 | -- | |
173 | hundred-and-one symptoms of being an internet addict: | |
174 | 215. Your mouse-clicking forearm rivals Popeye's. | |
175 | ||
176 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
177 | /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
178 | \\\ download, build and distribute -- http://www.A-A-P.org /// | |
179 | \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |