summaryrefslogtreecommitdiff
path: root/src
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
parente01f4f86cef7bed3cb99b26f9f57d86f6eb5fe1a (diff)
downloadvim-git-72f4cc4a987d123c0ed909c85b9a05f65cef7202.tar.gz
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')
-rw-r--r--src/feature.h4
-rw-r--r--src/gui.c31
-rw-r--r--src/hangulin.c46
-rw-r--r--src/proto/hangulin.pro2
-rw-r--r--src/screen.c8
-rw-r--r--src/ui.c9
-rw-r--r--src/version.c2
7 files changed, 92 insertions, 10 deletions
diff --git a/src/feature.h b/src/feature.h
index 01f611e38..c499d9d50 100644
--- a/src/feature.h
+++ b/src/feature.h
@@ -677,9 +677,6 @@
# define ESC_CHG_TO_ENG_MODE /* if defined, when ESC pressed,
* turn to english mode
*/
-# if !defined(FEAT_XFONTSET) && defined(HAVE_X11) && !defined(FEAT_GUI_GTK)
-# define FEAT_XFONTSET /* Hangul input requires xfontset */
-# endif
# if defined(FEAT_XIM) && !defined(LINT)
Error: You should select only ONE of XIM and HANGUL INPUT
# endif
@@ -687,7 +684,6 @@
#if defined(FEAT_HANGULIN) || defined(FEAT_XIM)
/* # define X_LOCALE */ /* for OS with incomplete locale
support, like old linux versions. */
-/* # define SLOW_XSERVER */ /* for extremely slow X server */
#endif
/*
diff --git a/src/gui.c b/src/gui.c
index fc2981c6c..07365224d 100644
--- a/src/gui.c
+++ b/src/gui.c
@@ -1223,8 +1223,19 @@ gui_update_cursor(force, clear_selection)
gui.highlight_mask = (cattr | attr);
#ifdef FEAT_HANGULIN
if (composing_hangul)
- (void)gui_outstr_nowrap(composing_hangul_buffer, 2,
- GUI_MON_IS_CURSOR | GUI_MON_NOCLEAR, cfg, cbg, 0);
+ {
+ char_u *comp_buf;
+ int comp_len;
+
+ comp_buf = hangul_composing_buffer_get(&comp_len);
+ if (comp_buf)
+ {
+ (void)gui_outstr_nowrap(comp_buf, comp_len,
+ GUI_MON_IS_CURSOR | GUI_MON_NOCLEAR,
+ cfg, cbg, 0);
+ vim_free(comp_buf);
+ }
+ }
else
#endif
(void)gui_screenchar(LineOffset[gui.row] + gui.col,
@@ -2572,9 +2583,19 @@ gui_undraw_cursor()
#ifdef FEAT_HANGULIN
if (composing_hangul
&& gui.col == gui.cursor_col && gui.row == gui.cursor_row)
- (void)gui_outstr_nowrap(composing_hangul_buffer, 2,
- GUI_MON_IS_CURSOR | GUI_MON_NOCLEAR,
- gui.norm_pixel, gui.back_pixel, 0);
+ {
+ char_u *comp_buf;
+ int comp_len;
+
+ comp_buf = hangul_composing_buffer_get(&comp_len);
+ if (comp_buf)
+ {
+ (void)gui_outstr_nowrap(comp_buf, comp_len,
+ GUI_MON_IS_CURSOR | GUI_MON_NOCLEAR,
+ gui.norm_pixel, gui.back_pixel, 0);
+ vim_free(comp_buf);
+ }
+ }
else
{
#endif
diff --git a/src/hangulin.c b/src/hangulin.c
index 24cf18002..f02cad817 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;
+}
diff --git a/src/proto/hangulin.pro b/src/proto/hangulin.pro
index adfde142f..59e6986bd 100644
--- a/src/proto/hangulin.pro
+++ b/src/proto/hangulin.pro
@@ -6,4 +6,6 @@ void hangul_input_state_toggle __ARGS((void));
void hangul_keyboard_set __ARGS((void));
int hangul_input_process __ARGS((char_u *s, int len));
void hangul_input_clear __ARGS((void));
+char_u *hangul_string_convert __ARGS((char_u *buf, int *p_len));
+char_u *hangul_composing_buffer_get __ARGS((int *p_len));
/* vim: set ft=c : */
diff --git a/src/screen.c b/src/screen.c
index b1af862d3..de9e04df6 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -10047,7 +10047,13 @@ showmode()
if (gui.in_use)
{
if (hangul_input_state_get())
- MSG_PUTS_ATTR(" \307\321\261\333", attr); /* HANGUL */
+ {
+ /* HANGUL */
+ if (enc_utf8)
+ MSG_PUTS_ATTR(" \355\225\234\352\270\200", attr);
+ else
+ MSG_PUTS_ATTR(" \307\321\261\333", attr);
+ }
}
#endif
#ifdef FEAT_INS_EXPAND
diff --git a/src/ui.c b/src/ui.c
index e0e54d924..5438a38c5 100644
--- a/src/ui.c
+++ b/src/ui.c
@@ -1723,8 +1723,17 @@ push_raw_key(s, len)
char_u *s;
int len;
{
+ char_u *tmpbuf;
+
+ tmpbuf = hangul_string_convert(s, &len);
+ if (tmpbuf != NULL)
+ s = tmpbuf;
+
while (len--)
inbuf[inbufcount++] = *s++;
+
+ if (tmpbuf != NULL)
+ vim_free(tmpbuf);
}
#endif
diff --git a/src/version.c b/src/version.c
index a0896f8d9..1604635ae 100644
--- a/src/version.c
+++ b/src/version.c
@@ -742,6 +742,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 913,
+/**/
912,
/**/
911,