[ElmSharp] Entry.CursorChanged event issue
shyunMin opened this issue · comments
Description
Entry returns different CursorPosition
when I selected a part of text string through double-click and long-press.
This issue occurs on Tizne 6.0 public(mobile, F-hub).
// select through double-click
I/DOTNET_LAUNCHER( 6702): [TEST] [CursorChanged] cursor: 8
I/DOTNET_LAUNCHER( 6702): [TEST] [CursorChanged] cursor: 12
I/DOTNET_LAUNCHER( 6702): [TEST] [CursorChanged] cursor: 12
I/DOTNET_LAUNCHER( 6702): [TEST] [CursorChanged] cursor: 12
I/DOTNET_LAUNCHER( 6702): [TEST] [SelectionChanged] cursor: 12
I/DOTNET_LAUNCHER( 6702): [TEST] [CursorChanged] cursor: 12
I/DOTNET_LAUNCHER( 6702): [TEST] [CursorChanged] cursor: 12
// select through long-press
I/DOTNET_LAUNCHER( 6702): [TEST] [CursorChanged] cursor: 8
I/DOTNET_LAUNCHER( 6702): [TEST] [CursorChanged] cursor: 12
I/DOTNET_LAUNCHER( 6702): [TEST] [CursorChanged] cursor: 12
I/DOTNET_LAUNCHER( 6702): [TEST] [CursorChanged] cursor: 12
I/DOTNET_LAUNCHER( 6702): [TEST] [SelectionChanged] cursor: 12
I/DOTNET_LAUNCHER( 6702): [TEST] [CursorChanged] cursor: 12
I/DOTNET_LAUNCHER( 6702): [TEST] [CursorChanged] cursor: 12
I/DOTNET_LAUNCHER( 6702): [TEST] [CursorChanged] cursor: 8 <-------
In both cases, CursorPosition
value is changed to the end of the selected text index.
However CursorChanged
event is invoked one more time when I released the entry after long-press.
Steps to Reproduce
Here is the sample code I used and the result logs.
namespace ElmSharp.Test
{
class EntryTest1 : TestCaseBase
{
public override string TestName => "EntryTest1";
public override void Run(Window window)
{
Background bg = new Background(window)
{
AlignmentX = -1,
AlignmentY = -1,
WeightX = 1,
WeightY = 1,
Color = Color.White
};
bg.Show();
window.AddResizeObject(bg);
Conformant conformant = new Conformant(window);
conformant.Show();
Box box = new Box(window);
conformant.SetContent(box);
box.Show();
Entry entry1 = new Entry(window)
{
AlignmentX = -1,
AlignmentY = 0,
WeightX = 1,
WeightY = 1,
IsSingleLine = true,
Text = "Entry Cursor Test"
};
entry1.Show();
entry1.CursorChanged += (s, e) =>
{
Console.WriteLine($" [TEST] [CursorChanged] cursor: {entry1.CursorPosition}");
};
var selectionChanged = new SmartEvent(entry1, "selection,changed");
selectionChanged.On += (s, e) =>
{
Console.WriteLine($" [TEST] [SelectionChanged] cursor: {entry1.CursorPosition}");
};
box.PackEnd(entry1);
}
}
}