summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Hirt <daniel.hirt@samsung.com>2015-03-18 15:34:28 +0200
committerDaniel Hirt <daniel.hirt@samsung.com>2015-04-22 12:55:31 +0300
commitc50ed65b45818464fb0c4c9470310e22e0eb123d (patch)
tree854db2b29494c4df7964a7b6bc4f2a85d4a798f9
parent4ba0227bf4903729cb79ff547cced9c62e80b97e (diff)
downloadefl-c50ed65b45818464fb0c4c9470310e22e0eb123d.tar.gz
evas/textblock: add _layout_item_text_split
This does the same as the older _layout_item_text_split_strip_white did, but does not eliminated the whitespace character. This is added for future usages. Also did some changes in _layout_item_text_split_strip_white to reduce code duplication.
-rw-r--r--src/lib/evas/canvas/evas_object_textblock.c44
1 files changed, 30 insertions, 14 deletions
diff --git a/src/lib/evas/canvas/evas_object_textblock.c b/src/lib/evas/canvas/evas_object_textblock.c
index 688e09d894..6d412bfcd9 100644
--- a/src/lib/evas/canvas/evas_object_textblock.c
+++ b/src/lib/evas/canvas/evas_object_textblock.c
@@ -3574,6 +3574,31 @@ _layout_text_cutoff_get(Ctxt *c, Evas_Object_Textblock_Format *fmt,
return -1;
}
+
+static Evas_Object_Textblock_Text_Item *
+_layout_item_text_split(Ctxt *c,
+ Evas_Object_Textblock_Text_Item *ti, Eina_List *lti, size_t cut)
+{
+ Evas_Object_Textblock_Text_Item *new_ti = NULL;
+
+ if (!IS_AT_END(ti, cut) && (ti->text_props.text_len > 0))
+ {
+ new_ti = _layout_text_item_new(c, ti->parent.format);
+ new_ti->parent.text_node = ti->parent.text_node;
+ new_ti->parent.text_pos = ti->parent.text_pos + cut;
+ new_ti->parent.merge = EINA_TRUE;
+
+ evas_common_text_props_split(&ti->text_props,
+ &new_ti->text_props, cut);
+ _layout_text_add_logical_item(c, new_ti, lti);
+ }
+ if (new_ti)
+ {
+ _text_item_update_sizes(c, ti);
+ }
+ return new_ti;
+}
+
/**
* @internal
* Split before cut, and strip if str[cut - 1] is a whitespace.
@@ -3589,22 +3614,11 @@ _layout_item_text_split_strip_white(Ctxt *c,
Evas_Object_Textblock_Text_Item *ti, Eina_List *lti, size_t cut)
{
const Eina_Unicode *ts;
- Evas_Object_Textblock_Text_Item *new_ti = NULL, *white_ti = NULL;
+ Evas_Object_Textblock_Text_Item *new_ti, *white_ti = NULL;
ts = GET_ITEM_TEXT(ti);
- if (!IS_AT_END(ti, cut) && (ti->text_props.text_len > 0))
- {
- new_ti = _layout_text_item_new(c, ti->parent.format);
- new_ti->parent.text_node = ti->parent.text_node;
- new_ti->parent.text_pos = ti->parent.text_pos + cut;
- new_ti->parent.merge = EINA_TRUE;
-
- evas_common_text_props_split(&ti->text_props,
- &new_ti->text_props, cut);
- _layout_text_add_logical_item(c, new_ti, lti);
- }
-
+ new_ti = _layout_item_text_split(c, ti, lti, cut);
/* Strip the previous white if needed */
if ((cut >= 1) && _is_white(ts[cut - 1]) && (ti->text_props.text_len > 0))
{
@@ -3628,7 +3642,9 @@ _layout_item_text_split_strip_white(Ctxt *c,
}
}
- if (new_ti || white_ti)
+ /* if new_ti != NULL, then the size is already updated in the
+ * called function _layout_item_text_split*/
+ if (white_ti)
{
_text_item_update_sizes(c, ti);
}