mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-28 08:47:59 +01:00
Fixes #4382. StringExtensions.GetColumns method should only return the total text width and not the sum of all runes width
This commit is contained in:
@@ -33,11 +33,11 @@ public class StringTests
|
||||
[InlineData ("🙂", 2)]
|
||||
[InlineData ("a🙂", 3)]
|
||||
[InlineData ("🙂a", 3)]
|
||||
[InlineData ("👨👩👦👦", 8)]
|
||||
[InlineData ("👨👩👦👦🙂", 10)]
|
||||
[InlineData ("👨👩👦👦🙂a", 11)]
|
||||
[InlineData ("👨👩👦👦a🙂", 11)]
|
||||
[InlineData ("👨👩👦👦👨👩👦👦", 16)]
|
||||
[InlineData ("👨👩👦👦", 2)]
|
||||
[InlineData ("👨👩👦👦🙂", 4)]
|
||||
[InlineData ("👨👩👦👦🙂a", 5)]
|
||||
[InlineData ("👨👩👦👦a🙂", 5)]
|
||||
[InlineData ("👨👩👦👦👨👩👦👦", 4)]
|
||||
[InlineData ("山", 2)] // The character for "mountain" in Chinese/Japanese/Korean (山), Unicode U+5C71
|
||||
[InlineData ("山🙂", 4)] // The character for "mountain" in Chinese/Japanese/Korean (山), Unicode U+5C71
|
||||
//[InlineData ("\ufe20\ufe21", 2)] // Combining Ligature Left Half ︠ - U+fe20 -https://github.com/microsoft/terminal/blob/main/src/types/unicode_width_overrides.xml
|
||||
@@ -57,4 +57,11 @@ public class StringTests
|
||||
var str = "a";
|
||||
Assert.Equal (1, str.GetColumns ());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestGetColumns_Zero_Width ()
|
||||
{
|
||||
var str = "\u200D";
|
||||
Assert.Equal (0, str.GetColumns ());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user