]>
Commit | Line | Data |
---|---|---|
d2415672 AG |
1 | To: vim-dev@vim.org |
2 | Subject: Patch 7.1.185 | |
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.185 | |
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 | |
17 | ||
18 | ||
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 | |
21 | *************** | |
22 | *** 6939,6944 **** | |
23 | --- 6939,6963 ---- | |
24 | ++replace_stack_nr; | |
25 | } | |
26 | ||
27 | + #if defined(FEAT_MBYTE) || defined(PROTO) | |
28 | + /* | |
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). | |
32 | + */ | |
33 | + int | |
34 | + replace_push_mb(p) | |
35 | + char_u *p; | |
36 | + { | |
37 | + int l = (*mb_ptr2len)(p); | |
38 | + int j; | |
39 | + | |
40 | + for (j = l - 1; j >= 0; --j) | |
41 | + replace_push(p[j]); | |
42 | + return l; | |
43 | + } | |
44 | + #endif | |
45 | + | |
46 | #if 0 | |
47 | /* | |
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 | |
51 | *************** | |
52 | *** 591,597 **** | |
53 | replace_push(NUL); | |
54 | p = saved_line + curwin->w_cursor.col; | |
55 | while (*p != NUL) | |
56 | ! replace_push(*p++); | |
57 | saved_line[curwin->w_cursor.col] = NUL; | |
58 | } | |
59 | #endif | |
60 | --- 592,605 ---- | |
61 | replace_push(NUL); | |
62 | p = saved_line + curwin->w_cursor.col; | |
63 | while (*p != NUL) | |
64 | ! { | |
65 | ! #ifdef FEAT_MBYTE | |
66 | ! if (has_mbyte) | |
67 | ! p += replace_push_mb(p); | |
68 | ! else | |
69 | ! #endif | |
70 | ! replace_push(*p++); | |
71 | ! } | |
72 | saved_line[curwin->w_cursor.col] = NUL; | |
73 | } | |
74 | #endif | |
75 | *************** | |
76 | *** 1914,1920 **** | |
77 | int charlen; | |
78 | { | |
79 | int c = buf[0]; | |
80 | - int l, j; | |
81 | #endif | |
82 | int newlen; /* nr of bytes inserted */ | |
83 | int oldlen; /* nr of bytes deleted (0 when not replacing) */ | |
84 | --- 1922,1927 ---- | |
85 | *************** | |
86 | *** 2016,2028 **** | |
87 | for (i = 0; i < oldlen; ++i) | |
88 | { | |
89 | #ifdef FEAT_MBYTE | |
90 | ! l = (*mb_ptr2len)(oldp + col + i) - 1; | |
91 | ! for (j = l; j >= 0; --j) | |
92 | ! replace_push(oldp[col + i + j]); | |
93 | ! i += l; | |
94 | ! #else | |
95 | ! replace_push(oldp[col + i]); | |
96 | #endif | |
97 | } | |
98 | } | |
99 | ||
100 | --- 2023,2033 ---- | |
101 | for (i = 0; i < oldlen; ++i) | |
102 | { | |
103 | #ifdef FEAT_MBYTE | |
104 | ! if (has_mbyte) | |
105 | ! i += replace_push_mb(oldp + col + i) - 1; | |
106 | ! else | |
107 | #endif | |
108 | + replace_push(oldp[col + i]); | |
109 | } | |
110 | } | |
111 | ||
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 | |
114 | *************** | |
115 | *** 32,37 **** | |
116 | --- 32,38 ---- | |
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 | |
126 | *************** | |
127 | *** 668,669 **** | |
128 | --- 668,671 ---- | |
129 | { /* Add new patch number below this line */ | |
130 | + /**/ | |
131 | + 185, | |
132 | /**/ | |
133 | ||
134 | -- | |
135 | Not too long ago, a keyboard was something to make music with... | |
136 | ||
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 /// |