forked from enlightenment/efl
Edje entry: return surrounding string until the start position of selection
This commit is contained in:
parent
e7cd15b04b
commit
3eb79d3c3d
|
@ -1,3 +1,7 @@
|
||||||
|
2013-05-14 Jihoon Kim
|
||||||
|
|
||||||
|
* Edje entry: return surrounding string until the start position of selection
|
||||||
|
|
||||||
2013-05-13 Thiep Ha
|
2013-05-13 Thiep Ha
|
||||||
|
|
||||||
* Edje: Added selection handlers to entry.
|
* Edje: Added selection handlers to entry.
|
||||||
|
|
2
NEWS
2
NEWS
|
@ -268,4 +268,4 @@ Fixes:
|
||||||
* Evas: Don't try blend on gl backened if the render option is COPY
|
* Evas: Don't try blend on gl backened if the render option is COPY
|
||||||
* Evas text: Fixed line size calculation when using multiple fonts.
|
* Evas text: Fixed line size calculation when using multiple fonts.
|
||||||
* Evas: Fix crash if app use native surface in wrong engine.
|
* Evas: Fix crash if app use native surface in wrong engine.
|
||||||
|
* Edje entry: return surrounding string until the start position of selection
|
||||||
|
|
|
@ -4042,6 +4042,7 @@ _edje_entry_imf_retrieve_surrounding_cb(void *data, Ecore_IMF_Context *ctx EINA_
|
||||||
Entry *en = NULL;
|
Entry *en = NULL;
|
||||||
const char *str;
|
const char *str;
|
||||||
char *plain_text;
|
char *plain_text;
|
||||||
|
Eina_Strbuf *buf = NULL;
|
||||||
|
|
||||||
if (!rp) return EINA_FALSE;
|
if (!rp) return EINA_FALSE;
|
||||||
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
||||||
|
@ -4056,14 +4057,45 @@ _edje_entry_imf_retrieve_surrounding_cb(void *data, Ecore_IMF_Context *ctx EINA_
|
||||||
{
|
{
|
||||||
str = _edje_entry_text_get(rp);
|
str = _edje_entry_text_get(rp);
|
||||||
if (str)
|
if (str)
|
||||||
|
{
|
||||||
plain_text = evas_textblock_text_markup_to_utf8(NULL, str);
|
plain_text = evas_textblock_text_markup_to_utf8(NULL, str);
|
||||||
|
|
||||||
|
if (plain_text)
|
||||||
|
{
|
||||||
|
if (en->have_selection)
|
||||||
|
{
|
||||||
|
buf = eina_strbuf_new();
|
||||||
|
|
||||||
|
if (en->sel_start)
|
||||||
|
eina_strbuf_append_n(buf, plain_text, evas_textblock_cursor_pos_get(en->sel_start));
|
||||||
else
|
else
|
||||||
plain_text = strdup("");
|
eina_strbuf_append(buf, plain_text);
|
||||||
*text = plain_text;
|
|
||||||
|
*text = strdup(eina_strbuf_string_get(buf));
|
||||||
|
eina_strbuf_free(buf);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
*text = strdup(plain_text);
|
||||||
|
|
||||||
|
free(plain_text);
|
||||||
|
plain_text = NULL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
*text = strdup("");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
*text = strdup("");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cursor_pos)
|
if (cursor_pos)
|
||||||
|
{
|
||||||
|
if (en->have_selection && en->sel_start)
|
||||||
|
*cursor_pos = evas_textblock_cursor_pos_get(en->sel_start);
|
||||||
|
else if (en->cursor)
|
||||||
*cursor_pos = evas_textblock_cursor_pos_get(en->cursor);
|
*cursor_pos = evas_textblock_cursor_pos_get(en->cursor);
|
||||||
|
else
|
||||||
|
*cursor_pos = 0;
|
||||||
|
}
|
||||||
|
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue