4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=ISO-8859-1
7 Content-Transfer-Encoding: 8bit
11 Problem: When "gUe" turns a German sharp s into SS the operation stops
12 before the end of the word. Latin2 has the same sharp s but it's
13 not changed to SS there.
14 Solution: Make sure all the characters are operated upon. Detect the sharp
15 s in latin2. Also fixes that changing case of a multi-byte
16 character that changes the byte cound doesn't always work.
20 *** ../vim-7.1.239/src/ops.c Wed Jan 16 20:01:14 2008
21 --- src/ops.c Tue Jan 22 16:00:07 2008
28 + static int swapchars __ARGS((int op_type, pos_T *pos, int length));
31 * Handle the (non-standard vi) tilde operator. Also for "gu", "gU" and "g?".
42 if (u_save((linenr_T)(oap->start.lnum - 1),
43 (linenr_T)(oap->end.lnum + 1)) == FAIL)
51 if (u_save((linenr_T)(oap->start.lnum - 1),
52 (linenr_T)(oap->end.lnum + 1)) == FAIL)
56 block_prep(oap, &bd, pos.lnum, FALSE);
58 ! for (todo = bd.textlen; todo > 0; --todo)
62 ! todo -= (*mb_ptr2len)(ml_get_pos(&pos)) - 1;
64 ! did_change |= swapchar(oap->op_type, &pos);
65 ! if (inc(&pos) == -1) /* at end of file */
68 # ifdef FEAT_NETBEANS_INTG
69 if (usingNetbeans && did_change)
73 block_prep(oap, &bd, pos.lnum, FALSE);
75 ! did_change = swapchars(oap->op_type, &pos, bd.textlen);
77 # ifdef FEAT_NETBEANS_INTG
78 if (usingNetbeans && did_change)
82 else if (!oap->inclusive)
85 ! while (ltoreq(pos, oap->end))
87 ! did_change |= swapchar(oap->op_type, &pos);
88 ! if (inc(&pos) == -1) /* at end of file */
94 changed_lines(oap->start.lnum, oap->start.col, oap->end.lnum + 1,
96 else if (!oap->inclusive)
99 ! did_change = swapchars(oap->op_type, &pos, oap->end.col - pos.col + 1);
102 changed_lines(oap->start.lnum, oap->start.col, oap->end.lnum + 1,
109 + * Invoke swapchar() on "length" bytes at position "pos".
110 + * "pos" is advanced to just after the changed characters.
111 + * "length" is rounded up to include the whole last multi-byte character.
112 + * Also works correctly when the number of bytes changes.
113 + * Returns TRUE if some character was changed.
116 + swapchars(op_type, pos, length)
122 + int did_change = 0;
124 + for (todo = length; todo > 0; --todo)
127 + int pos_col = pos->col;
130 + /* we're counting bytes, not characters */
131 + todo -= (*mb_ptr2len)(ml_get_pos(pos)) - 1;
133 + did_change |= swapchar(op_type, pos);
135 + /* Changing German sharp s to SS increases the column. */
136 + todo += pos->col - pos_col;
138 + if (inc(pos) == -1) /* at end of file */
145 * If op_type == OP_UPPER: make uppercase,
146 * if op_type == OP_LOWER: make lowercase,
147 * if op_type == OP_ROT13: do rot13 encoding,
153 ! if (op_type == OP_UPPER && enc_latin1like && c == 0xdf)
155 pos_T sp = curwin->w_cursor;
161 ! if (op_type == OP_UPPER && c == 0xdf
162 ! && (enc_latin1like || STRCMP(p_enc, "iso-8859-2") == 0))
164 pos_T sp = curwin->w_cursor;
166 *** ../vim-7.1.239/src/version.c Tue Jan 22 12:44:03 2008
167 --- src/version.c Tue Jan 22 15:36:36 2008
171 { /* Add new patch number below this line */
177 ARTHUR: It is I, Arthur, son of Uther Pendragon, from the castle of Camelot.
178 King of all Britons, defeator of the Saxons, sovereign of all England!
181 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
183 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
184 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
185 \\\ download, build and distribute -- http://www.A-A-P.org ///
186 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///