Evas textblock: Fixed bug in evas_textblock_cursor_word_start.

Fixed bug with 1 char word separators at the start of the
text when going to the start of the word (e.g: =test).

Reported by Thiep Ha. Thanks a lot.

SVN revision: 75595
This commit is contained in:
Tom Hacohen 2012-08-23 07:03:18 +00:00
parent 9b56c8b27a
commit 9848db657a
3 changed files with 14 additions and 8 deletions

View File

@ -975,3 +975,9 @@
2012-08-21 Sung W. Park (sung_)
* Fix evas_gl current_context update issue when evas_gl context is deleted.
2012-08-23 Tom Hacohen (TAsn)
* Textblock: Fixed bug with 1 char word separators at the start of the
text when going to the start of the word (e.g: "=test").

View File

@ -6133,16 +6133,10 @@ evas_textblock_cursor_word_start(Evas_Textblock_Cursor *cur)
i = cur->pos;
/* Skip the first one. This ensures we don't point to the nul, and also
* we just don't care about it anyway. */
if (i > 0) i--;
for ( ; i > 0 ; i--)
{
if (BREAK_AFTER(i))
if (BREAK_AFTER(i - 1))
{
/* Advance to the current char */
i++;
break;
}
}
@ -6194,7 +6188,7 @@ evas_textblock_cursor_word_end(Evas_Textblock_Cursor *cur)
#ifdef HAVE_LINEBREAK
free(breaks);
#endif
return EINA_TRUE;;
return EINA_TRUE;
}
EAPI Eina_Bool

View File

@ -590,6 +590,12 @@ START_TEST(evas_textblock_cursor)
fail_if(18 != evas_textblock_cursor_pos_get(cur));
evas_textblock_cursor_word_end(cur);
fail_if(18 != evas_textblock_cursor_pos_get(cur));
/* Bug with 1 char word separators at paragraph start. */
evas_object_textblock_text_markup_set(tb, "=test");
evas_textblock_cursor_pos_set(cur, 4);
evas_textblock_cursor_word_start(cur);
fail_if(1 != evas_textblock_cursor_pos_get(cur));
}
END_TB_TEST();