Fixes #4382. StringExtensions.GetColumns method should only return the total text width and not the sum of all runes width (#4383)

* Fixes #4382. StringExtensions.GetColumns method should only return the total text width and not the sum of all runes width

* Trying to fix unit test error

* Update StringExtensions.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Add unit test to prove that null and empty string doesn't not throws anything.

---------

Co-authored-by: Tig <tig@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
BDisp
2025-11-12 17:22:51 +00:00
committed by GitHub
parent be9d1939c1
commit fc818b0274
4 changed files with 60 additions and 11 deletions

View File

@@ -72,7 +72,6 @@ public class HexViewTests
Application.Top.Dispose ();
Application.ResetState (true);
}
[Fact]
@@ -321,6 +320,7 @@ public class HexViewTests
[Fact]
public void PositionChanged_Event ()
{
Application.Navigation = new ApplicationNavigation ();
var hv = new HexView (LoadStream (null, out _)) { Width = 20, Height = 10 };
Application.Top = new Toplevel ();
Application.Top.Add (hv);
@@ -346,6 +346,7 @@ public class HexViewTests
[Fact]
public void Source_Sets_Address_To_Zero_If_Greater_Than_Source_Length ()
{
Application.Navigation = new ApplicationNavigation ();
var hv = new HexView (LoadStream (null, out _)) { Width = 10, Height = 5 };
Application.Top = new Toplevel ();
Application.Top.Add (hv);