summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Hacohen <tom@stosb.com>2010-12-26 12:01:21 +0000
committerTom Hacohen <tom@stosb.com>2010-12-26 12:01:21 +0000
commit1557b40d76bc5b73f012f46f046e5b7ab2b74783 (patch)
treead98ed480be9896544e5976516c2a3719f408e0a
parent1046621d6a5fe8990d65f6470194c563c1119e17 (diff)
Evas textblock: Fixed evas_textblock_cursor_pos_set's handling with out of bound positions.
SVN revision: 55757
-rw-r--r--legacy/evas/src/lib/canvas/evas_object_textblock.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/legacy/evas/src/lib/canvas/evas_object_textblock.c b/legacy/evas/src/lib/canvas/evas_object_textblock.c
index 694fcd127b..7865a33ecc 100644
--- a/legacy/evas/src/lib/canvas/evas_object_textblock.c
+++ b/legacy/evas/src/lib/canvas/evas_object_textblock.c
@@ -5345,14 +5345,27 @@ evas_textblock_cursor_pos_set(Evas_Textblock_Cursor *cur, int _pos)
5345 } 5345 }
5346 5346
5347 n = o->text_nodes; 5347 n = o->text_nodes;
5348 while (pos >= eina_ustrbuf_length_get(n->unicode)) 5348 while (n && (pos >= eina_ustrbuf_length_get(n->unicode)))
5349 { 5349 {
5350 pos -= eina_ustrbuf_length_get(n->unicode); 5350 pos -= eina_ustrbuf_length_get(n->unicode);
5351 n = _NODE_TEXT(EINA_INLIST_GET(n)->next); 5351 n = _NODE_TEXT(EINA_INLIST_GET(n)->next);
5352 } 5352 }
5353 5353
5354 cur->node = n; 5354 if (n)
5355 cur->pos = pos; 5355 {
5356 cur->node = n;
5357 cur->pos = pos;
5358 }
5359 else
5360 {
5361 Evas_Object_Textblock_Node_Text *last_n;
5362
5363 last_n = _NODE_TEXT(EINA_INLIST_GET(o->text_nodes)->last);
5364 cur->node = last_n;
5365 cur->pos = 0;
5366
5367 evas_textblock_cursor_paragraph_char_last(cur);
5368 }
5356 5369
5357} 5370}
5358 5371