summaryrefslogtreecommitdiffstats
path: root/src/hangulin.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2015-11-10 14:35:18 +0100
committerBram Moolenaar <Bram@vim.org>2015-11-10 14:35:18 +0100
commit72f4cc4a987d123c0ed909c85b9a05f65cef7202 (patch)
tree1bc60bc28234d1b7dd050f8b95bebb577da9b736 /src/hangulin.c
parente01f4f86cef7bed3cb99b26f9f57d86f6eb5fe1a (diff)
patch 7.4.913v7.4.913
Problem: No utf-8 support for the hangul input feature. Solution: Add utf-8 support. (Namsh)
Diffstat (limited to 'src/hangulin.c')
-rw-r--r--src/hangulin.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/hangulin.c b/src/hangulin.c
index 24cf18002d..f02cad8174 100644
--- a/src/hangulin.c
+++ b/src/hangulin.c
@@ -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;
+}