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