Commit ca39d63b authored by Željan Rikalo's avatar Željan Rikalo 🏊🏼
Browse files

Gtk2: fixed keeping of SelStart() and SelLength().issue #23219

git-svn-id: trunk@39652 -
parent 55daa17a
......@@ -457,13 +457,14 @@ begin
begin
// if we change selstart in OnChange event new cursor pos need to
// be postponed in TGtk2WSCustomEdit.SetSelStart
NeedCursorCheck := True;
if g_object_get_data(PGObject(Widget),'lcl-gtkentry-pasted-data') <> nil then
begin
g_object_set_data(PGObject(Widget),'lcl-gtkentry-pasted-data',nil);
gtk_editable_set_position(PGtkEditable(Widget), GStart);
end else
begin
NeedCursorCheck := True;
//NeedCursorCheck := True;
if gtk_minor_version < 17 then
begin
g_object_set_data(PGObject(Widget),'lcl-gtkentry-pasted-data',Widget);
......
......@@ -1215,7 +1215,7 @@ begin
Entry := PGtkEntry(PWidgetInfo(Data)^.CoreWidget);
gtk_entry_select_region(Entry,
PWidgetInfo(Data)^.CursorPos,
PWidgetInfo(Data)^.SelLength);
PWidgetInfo(Data)^.CursorPos + PWidgetInfo(Data)^.SelLength);
g_idle_remove_by_data(Data);
end;
......@@ -1302,10 +1302,10 @@ begin
NewPos := Min(NewStart, Entry^.text_max_length)
else
NewPos := Min(NewStart, Entry^.text_length);
WidgetInfo := GetWidgetInfo(Entry);
WidgetInfo^.CursorPos := NewPos;
if LockOnChange(PgtkObject(Entry),0) > 0 then
begin
WidgetInfo := GetWidgetInfo(Entry);
WidgetInfo^.CursorPos := NewPos;
// postpone
g_idle_add(@gtk2WSDelayedSelStart, WidgetInfo);
end else
......@@ -1324,15 +1324,14 @@ begin
Entry := {%H-}PGtkEntry(ACustomEdit.Handle);
SelStart := GetSelStart(ACustomEdit);
WidgetInfo := GetWidgetInfo(Entry);
if WidgetInfo^.CursorPos = 0 then
WidgetInfo^.CursorPos := SelStart;
WidgetInfo^.SelLength := NewLength;
if LockOnChange(PgtkObject(Entry),0) > 0 then
begin
// delay setting of selection length. issue #20890
WidgetInfo := GetWidgetInfo(Entry);
if WidgetInfo^.CursorPos = 0 then
WidgetInfo^.CursorPos := SelStart;
WidgetInfo^.SelLength := SelStart + NewLength;
g_idle_add(@gtk2WSDelayedSetSelLength, WidgetInfo);
end else
g_idle_add(@gtk2WSDelayedSetSelLength, WidgetInfo)
else
gtk_entry_select_region(Entry,
SelStart,
SelStart + NewLength);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment