Skip to content

Commit 5efdac4

Browse files
committed
fix: GTK TextBox selection
1 parent ebf5d8e commit 5efdac4

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

src/Uno.UI.Runtime.Skia.Gtk/UI/Xaml/Controls/SinglelineTextBoxView.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#nullable enable
22

33
using System;
4+
using System.Reflection.Metadata.Ecma335;
45
using Gtk;
56
using Uno.Disposables;
67
using Windows.UI.Xaml.Controls;
@@ -29,8 +30,11 @@ public override string Text
2930

3031
public override bool IsCompatible(TextBox textBox) => !textBox.AcceptsReturn || textBox is PasswordBox;
3132

32-
public override (int start, int end) GetSelectionBounds() => _entry.GetSelectionBounds(out var start, out var end) ?
33-
(start, end) : (0, 0);
33+
public override (int start, int end) GetSelectionBounds()
34+
{
35+
_entry.GetSelectionBounds(out var start, out var end);
36+
return (start, end);
37+
}
3438

3539
public override void SetSelectionBounds(int start, int end) => _entry.SelectRegion(start_pos: start, end_pos: end);
3640

src/Uno.UI/UI/Xaml/Controls/TextBox/OverlayTextBoxView/OverlayTextBoxViewExtension.skia.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ public void StartEntry()
5151
_lastPosition = new Point(-1, -1);
5252
UpdateNativeView();
5353
SetNativeText(textBox.Text);
54-
InvalidateLayout();
5554

56-
_textBoxView!.AddToTextInputLayer(xamlRoot);
55+
_textBoxView!.AddToTextInputLayer(xamlRoot);
56+
InvalidateLayout();
5757
_textBoxView.SetFocus(true);
5858

5959
// Selection is now handled by native control

src/Uno.UI/UI/Xaml/Controls/TextBox/TextBoxView.skia.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,13 @@ internal void Select(int start, int length)
7777

7878
internal void OnForegroundChanged(Brush brush)
7979
{
80-
InnerText.Foreground = brush;
80+
DisplayBlock.Foreground = brush;
8181
_textBoxExtension?.UpdateProperties();
8282
}
8383

8484
internal void OnSelectionHighlightColorChanged(SolidColorBrush brush)
8585
{
86-
InnerText.SelectionHighlightColor = brush;
86+
DisplayBlock.SelectionHighlightColor = brush;
8787
_textBoxExtension?.UpdateProperties();
8888
}
8989

0 commit comments

Comments
 (0)