Fixed invalid text selection behaviour 59/258959/1
authorBowon Ryu <bowon.ryu@samsung.com>
Fri, 28 May 2021 08:17:00 +0000 (17:17 +0900)
committerBowon Ryu <bowon.ryu@samsung.com>
Fri, 28 May 2021 08:25:07 +0000 (17:25 +0900)
commit7fe4f51894c4c9f158e64b3d11d5d9c8ebdbf990
treee9832cd31699ecf3e0bddc2c891b7ebe75b8cd44
parent32d9c82fd183da60e3c54584d888388e73b92d34
Fixed invalid text selection behaviour

This patch fixes an issue where selection handles are not updated.
(issue of visual update, not value)

// test case
textField.SetProperty(DevelTextField::Property::PRIMARY_CURSOR_POSITION, 5);
textField.SetProperty(DevelTextField::Property::SELECTED_TEXT_START, 5);
textField.SetProperty(DevelTextField::Property::SELECTED_TEXT_END, 10);

In the test case above, the selection handle is not updated.

* Internal flag status when PRIMARY_CURSOR_POSITION is set :
in SetPrimaryCursorPosition(),

mUpdateCursorPosition = true;

* Internal flag status when SELECTED_TEXT_START, SELECTED_TEXT_END is set :
in SetTextSelectionRange(),

mUpdateHighlightBox = true;
mUpdateLeftSelectionPosition = true;
mUpdateRightSelectionPosition = true;

By the way,
the actual updates such as cursor, selection, grab handle, are handled at once
in ProcessInputEvents() based on the flags above.

In the test case, since mUpdateCursorPosition is true, "else" can not be reached.
That's why the selection handle doesn't update.
This issue is solved by fixing conditional statement.

Also due to this patch,
Issues arising from mPrimaryCursorPosition inside SetTextSelectionRange() are also resolved.

Change-Id: I77890fd3744406a885325e53e2354c1ac9d454d6
Signed-off-by: Bowon Ryu <bowon.ryu@samsung.com>
dali-toolkit/internal/text/text-controller-impl-event-handler.cpp