4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=ISO-8859-1
7 Content-Transfer-Encoding: 8bit
11 Problem: Using "gR" with a multi-byte encoding and typing a CR pushes
12 characters onto the replace stack incorrectly, resulting in BS
13 putting back the wrong characters. (Paul B. Mahol)
14 Solution: Push multi-byte characters onto the replace stack in reverse byte
15 order. Add replace_push_mb().
16 Files: src/edit.c, src/misc1.c, src/proto/edit.pro
19 *** ../vim-7.1.184/src/edit.c Sun Dec 9 20:25:59 2007
20 --- src/edit.c Tue Jan 1 17:28:07 2008
27 + #if defined(FEAT_MBYTE) || defined(PROTO)
29 + * Push a character onto the replace stack. Handles a multi-byte character in
30 + * reverse byte order, so that the first byte is popped off first.
31 + * Return the number of bytes done (includes composing characters).
37 + int l = (*mb_ptr2len)(p);
40 + for (j = l - 1; j >= 0; --j)
48 * call replace_push(c) with replace_offset set to the first NUL.
49 *** ../vim-7.1.184/src/misc1.c Wed Sep 26 22:35:06 2007
50 --- src/misc1.c Wed Jan 2 17:48:00 2008
54 p = saved_line + curwin->w_cursor.col;
57 saved_line[curwin->w_cursor.col] = NUL;
62 p = saved_line + curwin->w_cursor.col;
67 ! p += replace_push_mb(p);
72 saved_line[curwin->w_cursor.col] = NUL;
82 int newlen; /* nr of bytes inserted */
83 int oldlen; /* nr of bytes deleted (0 when not replacing) */
87 for (i = 0; i < oldlen; ++i)
90 ! l = (*mb_ptr2len)(oldp + col + i) - 1;
91 ! for (j = l; j >= 0; --j)
92 ! replace_push(oldp[col + i + j]);
95 ! replace_push(oldp[col + i]);
101 for (i = 0; i < oldlen; ++i)
105 ! i += replace_push_mb(oldp + col + i) - 1;
108 + replace_push(oldp[col + i]);
112 *** ../vim-7.1.184/src/proto/edit.pro Sat May 5 20:21:34 2007
113 --- src/proto/edit.pro Tue Jan 1 17:21:24 2008
117 char_u *get_last_insert __ARGS((void));
118 char_u *get_last_insert_save __ARGS((void));
119 void replace_push __ARGS((int c));
120 + int replace_push_mb __ARGS((char_u *p));
121 void fixthisline __ARGS((int (*get_the_indent)(void)));
122 void fix_indent __ARGS((void));
123 int in_cinkeys __ARGS((int keytyped, int when, int line_is_empty));
124 *** ../vim-7.1.184/src/version.c Wed Jan 2 16:25:20 2008
125 --- src/version.c Wed Jan 2 17:45:10 2008
129 { /* Add new patch number below this line */
135 Not too long ago, a keyboard was something to make music with...
137 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
138 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
139 \\\ download, build and distribute -- http://www.A-A-P.org ///
140 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///