0
0
mirror of https://github.com/vim/vim.git synced 2025-10-04 05:25:06 -04:00

patch 7.4.913

Problem:    No utf-8 support for the hangul input feature.
Solution:   Add utf-8 support. (Namsh)
This commit is contained in:
Bram Moolenaar
2015-11-10 14:35:18 +01:00
parent e01f4f86ce
commit 72f4cc4a98
8 changed files with 121 additions and 32 deletions

View File

@@ -1619,3 +1619,49 @@ convert_3_to_ks(fv, mv, lv, des)
*des++ = johab_lcon_to_wan[lv];
return 8;
}
char_u *
hangul_string_convert(buf, p_len)
char_u *buf;
int *p_len;
{
char_u *tmpbuf = NULL;
vimconv_T vc;
if (enc_utf8)
{
vc.vc_type = CONV_NONE;
if (convert_setup(&vc, (char_u *)"euc-kr", p_enc) == OK)
{
tmpbuf = string_convert(&vc, buf, p_len);
convert_setup(&vc, NULL, NULL);
}
}
return tmpbuf;
}
char_u *
hangul_composing_buffer_get(p_len)
int *p_len;
{
char_u *tmpbuf = NULL;
if (composing_hangul)
{
int len = 2;
tmpbuf = hangul_string_convert(composing_hangul_buffer, &len);
if (tmpbuf != NULL)
{
*p_len = len;
}
else
{
tmpbuf = vim_strnsave(composing_hangul_buffer, 2);
*p_len = 2;
}
}
return tmpbuf;
}