Spank spank spank !!! The summary lines are too long. It didn't show on phab. :( My bad.
Thanks to Quaker for pointing that out. -- Tom. On 04/08/14 11:07, Thiep Ha wrote: > tasn pushed a commit to branch master. > > http://git.enlightenment.org/core/efl.git/commit/?id=104f04eda19395396116ba4c4c23b17f00ace2ae > > commit 104f04eda19395396116ba4c4c23b17f00ace2ae > Author: Thiep Ha <thie...@gmail.com> > Date: Mon Aug 4 11:01:51 2014 +0100 > > Evas textblock: Correct word start/end moving at new line or line begins > with spaces > > Summary: > Word start/end works incorrectly when it goes to new line or line begins > with spaces. > Ex: In elementary_test/Entry, place cursor at the end of line, press > ctrl + right arrow keys: cursor moves to begin of next line. In this case, > cursor should move to end of 1st word in next line. > Ex2: In elementary_test/Entry, add some spaces to begin of 2nd line (" > uses markup"), place cursor at the first word ("uses"), press ctrl + left > arrow keys twice, cursor moves to begin of 2nd line. In this case, cursor > should move to begin of last word in 1st line. > > This patch provides a fix by considerring next/previous text node to > move cursor to correct place. > > @fix > > Reviewers: woohyun, raster, tasn > > Subscribers: cedric > > Differential Revision: https://phab.enlightenment.org/D1140 > --- > src/lib/evas/canvas/evas_object_textblock.c | 30 > ++++++++++++++++++++++++++++- > src/tests/evas/evas_test_textblock.c | 12 ++++++++++++ > 2 files changed, 41 insertions(+), 1 deletion(-) > > diff --git a/src/lib/evas/canvas/evas_object_textblock.c > b/src/lib/evas/canvas/evas_object_textblock.c > index 58cc476..87d6664 100644 > --- a/src/lib/evas/canvas/evas_object_textblock.c > +++ b/src/lib/evas/canvas/evas_object_textblock.c > @@ -7349,7 +7349,23 @@ evas_textblock_cursor_word_start(Evas_Textblock_Cursor > *cur) > > for (i = cur->pos ; _is_white(text[i]) && BREAK_AFTER(i) ; i--) > { > - if (i == 0) break; > + if (i == 0) > + { > + Evas_Object_Textblock_Node_Text *pnode; > + pnode = _NODE_TEXT(EINA_INLIST_GET(cur->node)->prev); > + if (pnode) > + { > + cur->node = pnode; > + len = eina_ustrbuf_length_get(cur->node->unicode); > + cur->pos = len - 1; > + free(breaks); > + return evas_textblock_cursor_word_start(cur); > + } > + else > + { > + break; > + } > + } > } > > for ( ; i > 0 ; i--) > @@ -7390,6 +7406,18 @@ evas_textblock_cursor_word_end(Evas_Textblock_Cursor > *cur) > } > > for (i = cur->pos; text[i] && _is_white(text[i]) && (BREAK_AFTER(i)) ; > i++); > + if (i == len) > + { > + Evas_Object_Textblock_Node_Text *nnode; > + nnode = _NODE_TEXT(EINA_INLIST_GET(cur->node)->next); > + if (nnode) > + { > + cur->node = nnode; > + cur->pos = 0; > + free(breaks); > + return evas_textblock_cursor_word_end(cur); > + } > + } > > for ( ; text[i] ; i++) > { > diff --git a/src/tests/evas/evas_test_textblock.c > b/src/tests/evas/evas_test_textblock.c > index a727b76..63ba40e 100644 > --- a/src/tests/evas/evas_test_textblock.c > +++ b/src/tests/evas/evas_test_textblock.c > @@ -637,6 +637,18 @@ START_TEST(evas_textblock_cursor) > > evas_textblock_cursor_word_end(cur); > ck_assert_int_eq(5, evas_textblock_cursor_pos_get(cur)); > + > + /* moving across paragraphs */ > + evas_object_textblock_text_markup_set(tb, > + "test<ps/>" > + " case"); > + evas_textblock_cursor_pos_set(cur, 4); > + evas_textblock_cursor_word_end(cur); > + ck_assert_int_eq(10, evas_textblock_cursor_pos_get(cur)); > + > + evas_textblock_cursor_pos_set(cur, 6); > + evas_textblock_cursor_word_start(cur); > + ck_assert_int_eq(0, evas_textblock_cursor_pos_get(cur)); > } > > /* Make sure coords are correct for ligatures */ > ------------------------------------------------------------------------------ Infragistics Professional Build stunning WinForms apps today! Reboot your WinForms applications with our WinForms controls. Build a bridge from your legacy apps to the future. http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk _______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel