From: Jean-Philippe Bruyère Date: Sat, 27 Mar 2021 17:40:28 +0000 (+0100) Subject: wip X-Git-Tag: v0.9.5-beta~43 X-Git-Url: https://git.osiis.dedyn.io/?a=commitdiff_plain;h=f441265e5159eb88fb2220bf1183c3d0547f29b4;p=jp%2Fcrow.git wip --- diff --git a/Crow/src/Text/TextSpan.cs b/Crow/src/Text/TextSpan.cs index 0ea0a638..ca1f3474 100644 --- a/Crow/src/Text/TextSpan.cs +++ b/Crow/src/Text/TextSpan.cs @@ -29,6 +29,7 @@ namespace Crow.Text public static bool operator ==(TextSpan left, TextSpan right) => left.Equals (right); public static bool operator !=(TextSpan left, TextSpan right) - => !left.Equals (right); + => !left.Equals (right); + public override string ToString() => $"{Start},{End}"; } } diff --git a/Crow/src/Widgets/Label.cs b/Crow/src/Widgets/Label.cs index 066793d0..00788de4 100644 --- a/Crow/src/Widgets/Label.cs +++ b/Crow/src/Widgets/Label.cs @@ -290,7 +290,9 @@ namespace Crow /// Current Selected text span. /// public TextSpan Selection { - get { + get { + if (CurrentLoc == null) + return default; CharLocation selStart = CurrentLoc.Value, selEnd = CurrentLoc.Value; if (selectionStart.HasValue) { if (CurrentLoc.Value.Line < selectionStart.Value.Line) { diff --git a/Samples/common/ui/Interfaces/Container/3.crow b/Samples/common/ui/Interfaces/Container/3.crow index 5ca515a8..4d6d1ec3 100644 --- a/Samples/common/ui/Interfaces/Container/3.crow +++ b/Samples/common/ui/Interfaces/Container/3.crow @@ -1,4 +1,4 @@  - \ No newline at end of file diff --git a/Samples/common/ui/Interfaces/Divers/testTextBox.crow b/Samples/common/ui/Interfaces/Divers/testTextBox.crow index f58e800e..266eeebb 100644 --- a/Samples/common/ui/Interfaces/Divers/testTextBox.crow +++ b/Samples/common/ui/Interfaces/Divers/testTextBox.crow @@ -1,22 +1,20 @@  - - - + + + - - - + + + Text="this is a test of a text boxthis is a test\nthis is a test when line are centered"/> \ No newline at end of file diff --git a/Samples/common/ui/Interfaces/TemplatedContainer/testPopper.crow b/Samples/common/ui/Interfaces/TemplatedContainer/testPopper.crow index beac8734..15de8eff 100644 --- a/Samples/common/ui/Interfaces/TemplatedContainer/testPopper.crow +++ b/Samples/common/ui/Interfaces/TemplatedContainer/testPopper.crow @@ -1,18 +1,11 @@  - - - - - - - - - - - + + + - + @@ -24,4 +17,5 @@ - +