aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Hacohen <tom@stosb.com>2014-02-07 13:05:06 +0000
committerTom Hacohen <tom@stosb.com>2014-02-07 13:19:19 +0000
commita4287e8703c9853481cc91c7b33785aedec8c2d6 (patch)
tree28704de49fe5bf02840ebbe11fd88d9e8fe14498
parentEvas textblock: Added tests for *_cursor_char_coord_set. (diff)
downloadefl-a4287e8703c9853481cc91c7b33785aedec8c2d6.tar.gz
Evas textblock: Fixed *_cursor_char_coord_set with some y values.
Specifically y values that are between par->y and the first ln->y. This should fix some selection issues with elm.
-rw-r--r--src/lib/evas/canvas/evas_object_textblock.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/lib/evas/canvas/evas_object_textblock.c b/src/lib/evas/canvas/evas_object_textblock.c
index b7c4d448d5..3ea0d08641 100644
--- a/src/lib/evas/canvas/evas_object_textblock.c
+++ b/src/lib/evas/canvas/evas_object_textblock.c
@@ -9773,17 +9773,22 @@ evas_textblock_cursor_char_coord_set(Evas_Textblock_Cursor *cur, Evas_Coord x, E
}
}
}
- else if (o->paragraphs && (y >= o->paragraphs->y + o->formatted.h))
- {
- /* If we are after the last paragraph, use the last position in the
- * text. */
- evas_textblock_cursor_paragraph_last(cur);
- return EINA_TRUE;
- }
- else if (o->paragraphs && (y < o->paragraphs->y))
+
+ if (o->paragraphs)
{
- evas_textblock_cursor_paragraph_first(cur);
- return EINA_TRUE;
+ Evas_Object_Textblock_Line *first_line = o->paragraphs->lines;
+ if (y >= o->paragraphs->y + o->formatted.h)
+ {
+ /* If we are after the last paragraph, use the last position in the
+ * text. */
+ evas_textblock_cursor_paragraph_last(cur);
+ return EINA_TRUE;
+ }
+ else if (o->paragraphs && (y < (o->paragraphs->y + first_line->y)))
+ {
+ evas_textblock_cursor_paragraph_first(cur);
+ return EINA_TRUE;
+ }
}
return EINA_FALSE;