#include <pthread.h>
#include <langinfo.h>
#include <unistd.h>
+#include <wctype.h>
#include <Evas.h>
#include <Ecore_Evas.h>
int cursor_pos = 0;
Eina_Unicode *ustr = NULL;
Ecore_IMF_Event_Delete_Surrounding ev;
- Eina_Unicode space_symbols[] = {' ', 0x00A0 /* no-break space */, 0x3000 /* ideographic space */};
- Eina_Unicode symbols[] = {' ', 0x00A0 /* no-break space */, 0x3000 /* ideographic space */,
- ':', ';', '.', '!', '?', 0x00BF /* ¿ */, 0x00A1 /* ¡ */,
- 0x3002 /* 。 */, 0x06D4 /* Urdu */, 0x0964 /* Hindi */,
- 0x0589 /* Armenian */, 0x17D4 /* Khmer */, 0x104A /* Myanmar */};
- const int symbol_num = sizeof (symbols) / sizeof (symbols[0]);
char *fullstop_mark = NULL;
if (autoperiod_allow == EINA_FALSE)
if (cursor_pos < 2) goto done;
- if (check_symbol (ustr[cursor_pos-1], space_symbols, (sizeof (space_symbols) / sizeof (space_symbols[0]))) &&
- (!check_symbol (ustr[cursor_pos-2], symbols, symbol_num))) {
+ if (iswblank (ustr[cursor_pos-1]) &&
+ !(iswpunct (ustr[cursor_pos-2]) || iswblank (ustr[cursor_pos-2]))) {
ev.ctx = ctx;
ev.n_chars = 1;
ev.offset = -1;
analyze_surrounding_text (Ecore_IMF_Context *ctx)
{
char *plain_str = NULL;
- char *markup_str = NULL;
Eina_Unicode puncs[] = {'\n','.', '!', '?', 0x00BF /* ¿ */, 0x00A1 /* ¡ */,
0x3002 /* 。 */, 0x06D4 /* Urdu */, 0x0964 /* Hindi */,
0x0589 /* Armenian */, 0x17D4 /* Khmer */, 0x104A /* Myanmar */};
- Eina_Unicode space_symbols[] = {' ', 0x00A0 /* no-break space */, 0x3000 /* ideographic space */};
Eina_Unicode *ustr = NULL;
Eina_Bool ret = EINA_FALSE;
Eina_Bool detect_space = EINA_FALSE;
if (context_scim->impl->preedit_updating)
return EINA_FALSE;
- ecore_imf_context_surrounding_get (ctx, &markup_str, &cursor_pos);
- if (!markup_str) goto done;
+ ecore_imf_context_surrounding_get (ctx, &plain_str, &cursor_pos);
+ if (!plain_str) goto done;
if (cursor_pos == 0) {
ret = EINA_TRUE;
goto done;
}
- // Convert into plain string
- plain_str = evas_textblock_text_markup_to_utf8 (NULL, markup_str);
- if (!plain_str) goto done;
-
// Convert string from UTF-8 to unicode
ustr = eina_unicode_utf8_to_unicode (plain_str, NULL);
if (!ustr) goto done;
if (cursor_pos >= 1) {
if (context_scim->impl->autocapital_type == ECORE_IMF_AUTOCAPITAL_TYPE_WORD) {
// Check space or no-break space
- if (check_symbol (ustr[cursor_pos-1], space_symbols, (sizeof (space_symbols) / sizeof (space_symbols[0])))) {
+ if (iswblank (ustr[cursor_pos-1])) {
ret = EINA_TRUE;
goto done;
}
for (i = cursor_pos; i > 0; i--) {
// Check space or no-break space
- if (check_symbol (ustr[i-1], space_symbols, (sizeof (space_symbols) / sizeof (space_symbols[0])))) {
+ if (iswblank (ustr[i-1])) {
detect_space = EINA_TRUE;
continue;
}
done:
if (ustr) free (ustr);
- if (markup_str) free (markup_str);
if (plain_str) free (plain_str);
return ret;