static x11_selection_type s_ptr[1];
/*
+ * Convert to EUC-JP
+ */
+#ifdef USE_XIM
+static void convert_to_euc(char *buf)
+{
+ size_t inlen = strlen(buf);
+ size_t outlen = inlen + 1;
+ char tmp[outlen];
+
+ iconv_t iconvd = iconv_open("EUC-JP", "UTF-8");
+ char *inbuf = buf;
+ char *outbuf = tmp;
+ iconv(iconvd, &inbuf, &inlen, &outbuf, &outlen);
+ iconv_close(iconvd);
+
+ int i, l = strlen(tmp);
+ for (i = 0; i < l; i++)
+ buf[i] = tmp[i];
+ buf[l] = '\0';
+}
+#endif
+
+/*
+ * Push multiple keys reversal
+ */
+static void term_string_push(char *buf)
+{
+ int i, l = strlen(buf);
+ for (i = l; i >= 0; i--)
+ term_key_push(buf[i]);
+}
+
+/*
* Process a keypress event
*
* Also appears in "main-xaw.c".
buf[n] = '\0';
#ifdef USE_XIM
- if(!valid_keysym){
- for (i = 0; buf[i]; i++) term_key_push(buf[i]);
-
+ if(!valid_keysym) { /* XIMからの入力時のみ FALSE になる */
+ convert_to_euc(buf);
+ term_string_push(buf);
return;
}
#endif
mx = (ev->state & Mod2Mask) ? TRUE : FALSE;
if (n && !mo && !mx && !IsSpecialKey(ks))
{
- for (i = 0; buf[i]; i++) term_key_push(buf[i]);
-
+ term_string_push(buf);
return;
}
ev->keycode, 13);
}
- for (i = 0; msg[i]; i++) term_key_push(msg[i]);
+ term_string_push(msg);
if (n && (macro_find_exact(msg) < 0))
{
char buf[80];
concptr str;
-
+text
int val;
XClassHint *ch;