|
Karsten Hopp |
0aa87c |
To: vim_dev@googlegroups.com
|
|
Karsten Hopp |
0aa87c |
Subject: Patch 7.3.814
|
|
Karsten Hopp |
0aa87c |
Fcc: outbox
|
|
Karsten Hopp |
0aa87c |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
Karsten Hopp |
0aa87c |
Mime-Version: 1.0
|
|
Karsten Hopp |
0aa87c |
Content-Type: text/plain; charset=UTF-8
|
|
Karsten Hopp |
0aa87c |
Content-Transfer-Encoding: 8bit
|
|
Karsten Hopp |
0aa87c |
------------
|
|
Karsten Hopp |
0aa87c |
|
|
Karsten Hopp |
0aa87c |
Patch 7.3.814
|
|
Karsten Hopp |
0aa87c |
Problem: Can't input multibyte characters on Win32 console if 'encoding' is
|
|
Karsten Hopp |
0aa87c |
different from current codepage.
|
|
Karsten Hopp |
0aa87c |
Solution: Use convert_input_safe() instead of convert_input(). Make
|
|
Karsten Hopp |
0aa87c |
string_convert_ext() return an error for incomplete input. (Ken
|
|
Karsten Hopp |
0aa87c |
Takata)
|
|
Karsten Hopp |
0aa87c |
Files: src/mbyte.c, src/os_win32.c
|
|
Karsten Hopp |
0aa87c |
|
|
Karsten Hopp |
0aa87c |
|
|
Karsten Hopp |
0aa87c |
*** ../vim-7.3.813/src/mbyte.c 2013-01-30 13:59:31.000000000 +0100
|
|
Karsten Hopp |
0aa87c |
--- src/mbyte.c 2013-02-13 16:38:25.000000000 +0100
|
|
Karsten Hopp |
0aa87c |
***************
|
|
Karsten Hopp |
0aa87c |
*** 6256,6263 ****
|
|
Karsten Hopp |
0aa87c |
if (vcp->vc_cpfrom == 0)
|
|
Karsten Hopp |
0aa87c |
tmp_len = utf8_to_utf16(ptr, len, NULL, NULL);
|
|
Karsten Hopp |
0aa87c |
else
|
|
Karsten Hopp |
0aa87c |
! tmp_len = MultiByteToWideChar(vcp->vc_cpfrom, 0,
|
|
Karsten Hopp |
0aa87c |
! ptr, len, 0, 0);
|
|
Karsten Hopp |
0aa87c |
tmp = (short_u *)alloc(sizeof(short_u) * tmp_len);
|
|
Karsten Hopp |
0aa87c |
if (tmp == NULL)
|
|
Karsten Hopp |
0aa87c |
break;
|
|
Karsten Hopp |
0aa87c |
--- 6256,6278 ----
|
|
Karsten Hopp |
0aa87c |
if (vcp->vc_cpfrom == 0)
|
|
Karsten Hopp |
0aa87c |
tmp_len = utf8_to_utf16(ptr, len, NULL, NULL);
|
|
Karsten Hopp |
0aa87c |
else
|
|
Karsten Hopp |
0aa87c |
! {
|
|
Karsten Hopp |
0aa87c |
! tmp_len = MultiByteToWideChar(vcp->vc_cpfrom,
|
|
Karsten Hopp |
0aa87c |
! unconvlenp ? MB_ERR_INVALID_CHARS : 0,
|
|
Karsten Hopp |
0aa87c |
! ptr, len, 0, 0);
|
|
Karsten Hopp |
0aa87c |
! if (tmp_len == 0
|
|
Karsten Hopp |
0aa87c |
! && GetLastError() == ERROR_NO_UNICODE_TRANSLATION)
|
|
Karsten Hopp |
0aa87c |
! {
|
|
Karsten Hopp |
0aa87c |
! if (lenp != NULL)
|
|
Karsten Hopp |
0aa87c |
! *lenp = 0;
|
|
Karsten Hopp |
0aa87c |
! if (unconvlenp != NULL)
|
|
Karsten Hopp |
0aa87c |
! *unconvlenp = len;
|
|
Karsten Hopp |
0aa87c |
! retval = alloc(1);
|
|
Karsten Hopp |
0aa87c |
! if (retval)
|
|
Karsten Hopp |
0aa87c |
! retval[0] = NUL;
|
|
Karsten Hopp |
0aa87c |
! return retval;
|
|
Karsten Hopp |
0aa87c |
! }
|
|
Karsten Hopp |
0aa87c |
! }
|
|
Karsten Hopp |
0aa87c |
tmp = (short_u *)alloc(sizeof(short_u) * tmp_len);
|
|
Karsten Hopp |
0aa87c |
if (tmp == NULL)
|
|
Karsten Hopp |
0aa87c |
break;
|
|
Karsten Hopp |
0aa87c |
*** ../vim-7.3.813/src/os_win32.c 2012-11-20 16:53:34.000000000 +0100
|
|
Karsten Hopp |
0aa87c |
--- src/os_win32.c 2013-02-13 16:41:05.000000000 +0100
|
|
Karsten Hopp |
0aa87c |
***************
|
|
Karsten Hopp |
0aa87c |
*** 1466,1471 ****
|
|
Karsten Hopp |
0aa87c |
--- 1466,1476 ----
|
|
Karsten Hopp |
0aa87c |
#define TYPEAHEADLEN 20
|
|
Karsten Hopp |
0aa87c |
static char_u typeahead[TYPEAHEADLEN]; /* previously typed bytes. */
|
|
Karsten Hopp |
0aa87c |
static int typeaheadlen = 0;
|
|
Karsten Hopp |
0aa87c |
+ #ifdef FEAT_MBYTE
|
|
Karsten Hopp |
0aa87c |
+ static char_u *rest = NULL; /* unconverted rest of previous read */
|
|
Karsten Hopp |
0aa87c |
+ static int restlen = 0;
|
|
Karsten Hopp |
0aa87c |
+ int unconverted;
|
|
Karsten Hopp |
0aa87c |
+ #endif
|
|
Karsten Hopp |
0aa87c |
|
|
Karsten Hopp |
0aa87c |
/* First use any typeahead that was kept because "buf" was too small. */
|
|
Karsten Hopp |
0aa87c |
if (typeaheadlen > 0)
|
|
Karsten Hopp |
0aa87c |
***************
|
|
Karsten Hopp |
0aa87c |
*** 1569,1574 ****
|
|
Karsten Hopp |
0aa87c |
--- 1574,1606 ----
|
|
Karsten Hopp |
0aa87c |
|
|
Karsten Hopp |
0aa87c |
c = tgetch(&modifiers, &ch2;;
|
|
Karsten Hopp |
0aa87c |
|
|
Karsten Hopp |
0aa87c |
+ #ifdef FEAT_MBYTE
|
|
Karsten Hopp |
0aa87c |
+ /* stolen from fill_input_buf() in ui.c */
|
|
Karsten Hopp |
0aa87c |
+ if (rest != NULL)
|
|
Karsten Hopp |
0aa87c |
+ {
|
|
Karsten Hopp |
0aa87c |
+ /* Use remainder of previous call, starts with an invalid
|
|
Karsten Hopp |
0aa87c |
+ * character that may become valid when reading more. */
|
|
Karsten Hopp |
0aa87c |
+ if (restlen > TYPEAHEADLEN - typeaheadlen)
|
|
Karsten Hopp |
0aa87c |
+ unconverted = TYPEAHEADLEN - typeaheadlen;
|
|
Karsten Hopp |
0aa87c |
+ else
|
|
Karsten Hopp |
0aa87c |
+ unconverted = restlen;
|
|
Karsten Hopp |
0aa87c |
+ mch_memmove(typeahead + typeaheadlen, rest, unconverted);
|
|
Karsten Hopp |
0aa87c |
+ if (unconverted == restlen)
|
|
Karsten Hopp |
0aa87c |
+ {
|
|
Karsten Hopp |
0aa87c |
+ vim_free(rest);
|
|
Karsten Hopp |
0aa87c |
+ rest = NULL;
|
|
Karsten Hopp |
0aa87c |
+ }
|
|
Karsten Hopp |
0aa87c |
+ else
|
|
Karsten Hopp |
0aa87c |
+ {
|
|
Karsten Hopp |
0aa87c |
+ restlen -= unconverted;
|
|
Karsten Hopp |
0aa87c |
+ mch_memmove(rest, rest + unconverted, restlen);
|
|
Karsten Hopp |
0aa87c |
+ }
|
|
Karsten Hopp |
0aa87c |
+ typeaheadlen += unconverted;
|
|
Karsten Hopp |
0aa87c |
+ }
|
|
Karsten Hopp |
0aa87c |
+ else
|
|
Karsten Hopp |
0aa87c |
+ unconverted = 0;
|
|
Karsten Hopp |
0aa87c |
+ #endif
|
|
Karsten Hopp |
0aa87c |
+
|
|
Karsten Hopp |
0aa87c |
if (typebuf_changed(tb_change_cnt))
|
|
Karsten Hopp |
0aa87c |
{
|
|
Karsten Hopp |
0aa87c |
/* "buf" may be invalid now if a client put something in the
|
|
Karsten Hopp |
0aa87c |
***************
|
|
Karsten Hopp |
0aa87c |
*** 1604,1611 ****
|
|
Karsten Hopp |
0aa87c |
* when 'tenc' is set. */
|
|
Karsten Hopp |
0aa87c |
if (input_conv.vc_type != CONV_NONE
|
|
Karsten Hopp |
0aa87c |
&& (ch2 == NUL || c != K_NUL))
|
|
Karsten Hopp |
0aa87c |
! n = convert_input(typeahead + typeaheadlen, n,
|
|
Karsten Hopp |
0aa87c |
! TYPEAHEADLEN - typeaheadlen);
|
|
Karsten Hopp |
0aa87c |
#endif
|
|
Karsten Hopp |
0aa87c |
|
|
Karsten Hopp |
0aa87c |
/* Use the ALT key to set the 8th bit of the character
|
|
Karsten Hopp |
0aa87c |
--- 1636,1647 ----
|
|
Karsten Hopp |
0aa87c |
* when 'tenc' is set. */
|
|
Karsten Hopp |
0aa87c |
if (input_conv.vc_type != CONV_NONE
|
|
Karsten Hopp |
0aa87c |
&& (ch2 == NUL || c != K_NUL))
|
|
Karsten Hopp |
0aa87c |
! {
|
|
Karsten Hopp |
0aa87c |
! typeaheadlen -= unconverted;
|
|
Karsten Hopp |
0aa87c |
! n = convert_input_safe(typeahead + typeaheadlen,
|
|
Karsten Hopp |
0aa87c |
! n + unconverted, TYPEAHEADLEN - typeaheadlen,
|
|
Karsten Hopp |
0aa87c |
! rest == NULL ? &rest : NULL, &restlen);
|
|
Karsten Hopp |
0aa87c |
! }
|
|
Karsten Hopp |
0aa87c |
#endif
|
|
Karsten Hopp |
0aa87c |
|
|
Karsten Hopp |
0aa87c |
/* Use the ALT key to set the 8th bit of the character
|
|
Karsten Hopp |
0aa87c |
*** ../vim-7.3.813/src/version.c 2013-02-13 16:30:17.000000000 +0100
|
|
Karsten Hopp |
0aa87c |
--- src/version.c 2013-02-13 16:47:50.000000000 +0100
|
|
Karsten Hopp |
0aa87c |
***************
|
|
Karsten Hopp |
0aa87c |
*** 727,728 ****
|
|
Karsten Hopp |
0aa87c |
--- 727,730 ----
|
|
Karsten Hopp |
0aa87c |
{ /* Add new patch number below this line */
|
|
Karsten Hopp |
0aa87c |
+ /**/
|
|
Karsten Hopp |
0aa87c |
+ 814,
|
|
Karsten Hopp |
0aa87c |
/**/
|
|
Karsten Hopp |
0aa87c |
|
|
Karsten Hopp |
0aa87c |
--
|
|
Karsten Hopp |
0aa87c |
SIGIRO -- irony detected (iron core dumped)
|
|
Karsten Hopp |
0aa87c |
|
|
Karsten Hopp |
0aa87c |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
Karsten Hopp |
0aa87c |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
Karsten Hopp |
0aa87c |
\\\ an exciting new programming language -- http://www.Zimbu.org ///
|
|
Karsten Hopp |
0aa87c |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|