@@ -619,7 +619,7 @@ win32_enable_privilege(LPTSTR lpszPrivilege, BOOL bEnable)
619619 return FALSE;
620620 }
621621
622- tokenPrivileges .PrivilegeCount = 1 ;
622+ tokenPrivileges .PrivilegeCount = 1 ;
623623 tokenPrivileges .Privileges [0 ].Luid = luid ;
624624 tokenPrivileges .Privileges [0 ].Attributes = bEnable ?
625625 SE_PRIVILEGE_ENABLED : 0 ;
@@ -1785,13 +1785,14 @@ mch_inchar(
17851785#endif
17861786 {
17871787 int n = 1 ;
1788+ int conv = FALSE;
17881789
1789- /* A key may have one or two bytes. */
17901790 typeahead [typeaheadlen ] = c ;
17911791 if (ch2 != NUL )
17921792 {
1793- typeahead [typeaheadlen + 1 ] = ch2 ;
1794- ++ n ;
1793+ typeahead [typeaheadlen + 1 ] = 3 ;
1794+ typeahead [typeaheadlen + 2 ] = ch2 ;
1795+ n += 2 ;
17951796 }
17961797#ifdef FEAT_MBYTE
17971798 /* Only convert normal characters, not special keys. Need to
@@ -1800,13 +1801,32 @@ mch_inchar(
18001801 if (input_conv .vc_type != CONV_NONE
18011802 && (ch2 == NUL || c != K_NUL ))
18021803 {
1804+ conv = TRUE;
18031805 typeaheadlen -= unconverted ;
18041806 n = convert_input_safe (typeahead + typeaheadlen ,
18051807 n + unconverted , TYPEAHEADLEN - typeaheadlen ,
18061808 rest == NULL ? & rest : NULL , & restlen );
18071809 }
18081810#endif
18091811
1812+ if (conv )
1813+ {
1814+ char_u * p = typeahead + typeaheadlen ;
1815+ char_u * e = typeahead + TYPEAHEADLEN ;
1816+
1817+ while (* p && p < e )
1818+ {
1819+ if (* p == K_NUL )
1820+ {
1821+ ++ p ;
1822+ mch_memmove (p + 1 , p , ((size_t )(e - p )) - 1 );
1823+ * p = 3 ;
1824+ ++ n ;
1825+ }
1826+ ++ p ;
1827+ }
1828+ }
1829+
18101830 /* Use the ALT key to set the 8th bit of the character
18111831 * when it's one byte, the 8th bit isn't set yet and not
18121832 * using a double-byte encoding (would become a lead
0 commit comments