summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Hirt <daniel.hirt@samsung.com>2016-06-20 16:54:43 +0000
committerDaniel Hirt <daniel.hirt@samsung.com>2016-06-21 10:34:19 +0000
commit2651ab54a3ff7591329d8047b11fa2dc70677b45 (patch)
treee72fc371e5fb82cc71ab2c9ecdc35a9be3b2431a
parente920b47d2b28d9ecfcc9984e0e1f435640f3de3f (diff)
Canvas text cursor: fix text insertion
The cursor update hasn't considered when the pararaph is broken. The reason the code path is different from legacy is because that it was originally intended to support append and prepend operations in the new API. Since we don't anymore (only supporting append operations in the new cursor with 'text_insert'), we can simplify the insertion implementation and fix this.
-rw-r--r--src/lib/evas/canvas/evas_object_textblock.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/src/lib/evas/canvas/evas_object_textblock.c b/src/lib/evas/canvas/evas_object_textblock.c
index f3b94dd4be..fd0106bb30 100644
--- a/src/lib/evas/canvas/evas_object_textblock.c
+++ b/src/lib/evas/canvas/evas_object_textblock.c
@@ -9870,7 +9870,6 @@ _efl_canvas_text_cursor_text_insert(Eo *cur_obj,
9870 Efl_Canvas_Text_Cursor_Data *cur, const char *_text) 9870 Efl_Canvas_Text_Cursor_Data *cur, const char *_text)
9871{ 9871{
9872 int len = _efl_canvas_text_cursor_text_append(cur, _text); 9872 int len = _efl_canvas_text_cursor_text_append(cur, _text);
9873 cur->pos += len;
9874 eo_event_callback_call(cur_obj, EFL_CANVAS_TEXT_CURSOR_EVENT_CHANGED, NULL); 9873 eo_event_callback_call(cur_obj, EFL_CANVAS_TEXT_CURSOR_EVENT_CHANGED, NULL);
9875 return len; 9874 return len;
9876} 9875}
@@ -13526,12 +13525,6 @@ _efl_canvas_text_cursor_text_append(Efl_Canvas_Text_Cursor_Data *cur,
13526 const char *off = text; 13525 const char *off = text;
13527 int len = 0; 13526 int len = 0;
13528 13527
13529 /* We make use of prepending the cursor, but this needs to return the current
13530 * position's cursor, so we use a temporary one. */
13531 Efl_Canvas_Text_Cursor_Data cur2;
13532 _evas_textblock_cursor_init(&cur2, cur->obj);
13533 _evas_textblock_cursor_copy(&cur2, cur);
13534
13535 Evas_Object_Protected_Data *obj = eo_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS); 13528 Evas_Object_Protected_Data *obj = eo_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS);
13536 evas_object_async_block(obj); 13529 evas_object_async_block(obj);
13537 13530
@@ -13553,8 +13546,8 @@ _efl_canvas_text_cursor_text_append(Efl_Canvas_Text_Cursor_Data *cur,
13553 13546
13554 if (format) 13547 if (format)
13555 { 13548 {
13556 len += _prepend_text_run2(&cur2, text, off); 13549 len += _prepend_text_run2(cur, text, off);
13557 if (_evas_textblock_cursor_format_prepend(&cur2, format)) 13550 if (_evas_textblock_cursor_format_prepend(cur, format))
13558 { 13551 {
13559 len++; 13552 len++;
13560 } 13553 }
@@ -13562,7 +13555,7 @@ _efl_canvas_text_cursor_text_append(Efl_Canvas_Text_Cursor_Data *cur,
13562 } 13555 }
13563 off += n; 13556 off += n;
13564 } 13557 }
13565 len += _prepend_text_run2(&cur2, text, off); 13558 len += _prepend_text_run2(cur, text, off);
13566 return len; 13559 return len;
13567} 13560}
13568 13561
@@ -13570,11 +13563,8 @@ EOLIAN static void
13570_efl_canvas_text_efl_text_text_set(Eo *eo_obj, Efl_Canvas_Text_Data *o EINA_UNUSED, 13563_efl_canvas_text_efl_text_text_set(Eo *eo_obj, Efl_Canvas_Text_Data *o EINA_UNUSED,
13571 const char *text) 13564 const char *text)
13572{ 13565{
13573 Efl_Canvas_Text_Cursor_Data cur;
13574
13575 evas_object_textblock_text_markup_set(eo_obj, ""); 13566 evas_object_textblock_text_markup_set(eo_obj, "");
13576 _evas_textblock_cursor_init(&cur, eo_obj); 13567 efl_canvas_text_cursor_text_insert(o->cursor, text);
13577 _efl_canvas_text_cursor_text_append(&cur, text);
13578} 13568}
13579 13569
13580EOLIAN static const char * 13570EOLIAN static const char *