From 7a7222508dfc1bdd216e62bc3ba3106e41a8e419 Mon Sep 17 00:00:00 2001 From: Karsten Hopp Date: Jan 07 2008 17:02:38 +0000 Subject: - patchlevel 185 --- diff --git a/7.1.185 b/7.1.185 new file mode 100644 index 0000000..0a1e092 --- /dev/null +++ b/7.1.185 @@ -0,0 +1,140 @@ +To: vim-dev@vim.org +Subject: Patch 7.1.185 +Fcc: outbox +From: Bram Moolenaar +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 8bit +------------ + +Patch 7.1.185 +Problem: Using "gR" with a multi-byte encoding and typing a CR pushes + characters onto the replace stack incorrectly, resulting in BS + putting back the wrong characters. (Paul B. Mahol) +Solution: Push multi-byte characters onto the replace stack in reverse byte + order. Add replace_push_mb(). +Files: src/edit.c, src/misc1.c, src/proto/edit.pro + + +*** ../vim-7.1.184/src/edit.c Sun Dec 9 20:25:59 2007 +--- src/edit.c Tue Jan 1 17:28:07 2008 +*************** +*** 6939,6944 **** +--- 6939,6963 ---- + ++replace_stack_nr; + } + ++ #if defined(FEAT_MBYTE) || defined(PROTO) ++ /* ++ * Push a character onto the replace stack. Handles a multi-byte character in ++ * reverse byte order, so that the first byte is popped off first. ++ * Return the number of bytes done (includes composing characters). ++ */ ++ int ++ replace_push_mb(p) ++ char_u *p; ++ { ++ int l = (*mb_ptr2len)(p); ++ int j; ++ ++ for (j = l - 1; j >= 0; --j) ++ replace_push(p[j]); ++ return l; ++ } ++ #endif ++ + #if 0 + /* + * call replace_push(c) with replace_offset set to the first NUL. +*** ../vim-7.1.184/src/misc1.c Wed Sep 26 22:35:06 2007 +--- src/misc1.c Wed Jan 2 17:48:00 2008 +*************** +*** 591,597 **** + replace_push(NUL); + p = saved_line + curwin->w_cursor.col; + while (*p != NUL) +! replace_push(*p++); + saved_line[curwin->w_cursor.col] = NUL; + } + #endif +--- 592,605 ---- + replace_push(NUL); + p = saved_line + curwin->w_cursor.col; + while (*p != NUL) +! { +! #ifdef FEAT_MBYTE +! if (has_mbyte) +! p += replace_push_mb(p); +! else +! #endif +! replace_push(*p++); +! } + saved_line[curwin->w_cursor.col] = NUL; + } + #endif +*************** +*** 1914,1920 **** + int charlen; + { + int c = buf[0]; +- int l, j; + #endif + int newlen; /* nr of bytes inserted */ + int oldlen; /* nr of bytes deleted (0 when not replacing) */ +--- 1922,1927 ---- +*************** +*** 2016,2028 **** + for (i = 0; i < oldlen; ++i) + { + #ifdef FEAT_MBYTE +! l = (*mb_ptr2len)(oldp + col + i) - 1; +! for (j = l; j >= 0; --j) +! replace_push(oldp[col + i + j]); +! i += l; +! #else +! replace_push(oldp[col + i]); + #endif + } + } + +--- 2023,2033 ---- + for (i = 0; i < oldlen; ++i) + { + #ifdef FEAT_MBYTE +! if (has_mbyte) +! i += replace_push_mb(oldp + col + i) - 1; +! else + #endif ++ replace_push(oldp[col + i]); + } + } + +*** ../vim-7.1.184/src/proto/edit.pro Sat May 5 20:21:34 2007 +--- src/proto/edit.pro Tue Jan 1 17:21:24 2008 +*************** +*** 32,37 **** +--- 32,38 ---- + char_u *get_last_insert __ARGS((void)); + char_u *get_last_insert_save __ARGS((void)); + void replace_push __ARGS((int c)); ++ int replace_push_mb __ARGS((char_u *p)); + void fixthisline __ARGS((int (*get_the_indent)(void))); + void fix_indent __ARGS((void)); + int in_cinkeys __ARGS((int keytyped, int when, int line_is_empty)); +*** ../vim-7.1.184/src/version.c Wed Jan 2 16:25:20 2008 +--- src/version.c Wed Jan 2 17:45:10 2008 +*************** +*** 668,669 **** +--- 668,671 ---- + { /* Add new patch number below this line */ ++ /**/ ++ 185, + /**/ + +-- +Not too long ago, a keyboard was something to make music with... + + /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ +/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ +\\\ download, build and distribute -- http://www.A-A-P.org /// + \\\ help me help AIDS victims -- http://ICCF-Holland.org ///