Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
3c6e945
Fixes #4382. StringExtensions.GetColumns method should only return th…
BDisp Nov 8, 2025
3b36714
Trying to fix unit test error
BDisp Nov 8, 2025
034ccbe
Merge branch 'v2_develop' into v2_4382_stringextensions-getcolumns-fix
tig Nov 12, 2025
0e3f646
Merge branch 'v2_develop' into v2_4382_stringextensions-getcolumns-fix
tig Nov 12, 2025
012356e
Merge branch 'v2_develop' into v2_4382_stringextensions-getcolumns-fix
tig Nov 12, 2025
78cfe73
Update StringExtensions.cs
tig Nov 12, 2025
87ea2af
Resolving merge conflicts
BDisp Nov 12, 2025
37c9718
Prevents Runes throwing if Grapheme is null
BDisp Nov 12, 2025
178e1e7
Add unit test to prove that null and empty string doesn't not throws …
BDisp Nov 12, 2025
d3d4c25
Resolving merge conflicts
BDisp Nov 12, 2025
817b3e4
Resolving merge conflicts
BDisp Nov 12, 2025
9b08101
Fix unit test failure
BDisp Nov 12, 2025
7c836b9
Merge branch 'v2_develop' into v2_4387_cell-refactoring
BDisp Nov 12, 2025
8d6f162
Fix IsValidLocation for wide graphemes
BDisp Nov 12, 2025
53b5cc2
Add more combining
BDisp Nov 14, 2025
0fad703
Prevent set invalid graphemes
BDisp Nov 14, 2025
4ae48d0
Fix unit tests
BDisp Nov 14, 2025
1e8a37d
Grapheme doesn't support invalid code points like lone surrogates
BDisp Nov 14, 2025
5974e81
Fixes more unit tests
BDisp Nov 14, 2025
410bcbe
Fix unit test
BDisp Nov 14, 2025
5e87af7
Seems all test are fixed now
BDisp Nov 14, 2025
ff538e3
Adjust CharMap scenario with graphemes
BDisp Nov 14, 2025
6afe4c8
Upgrade Wcwidth to version 4.0.0
BDisp Nov 14, 2025
f3e4a2d
Reformat
BDisp Nov 14, 2025
c9b46b7
Trying fix CheckDefaultState assertion
BDisp Nov 14, 2025
1060ac9
Revert "Trying fix CheckDefaultState assertion"
BDisp Nov 14, 2025
ff34a14
Forgot to include driver.End in the test
BDisp Nov 14, 2025
b6072bb
Reapply "Trying fix CheckDefaultState assertion"
BDisp Nov 14, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="[9.0.0,10)" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="9.0.6" />
<PackageVersion Include="System.IO.Abstractions" Version="[22.0.16,23)" />
<PackageVersion Include="Wcwidth" Version="[3.0.0,)" />
<PackageVersion Include="Wcwidth" Version="[4.0.0,)" />
<PackageVersion Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="[1.21.2,2)" />
<PackageVersion Include="Serilog" Version="4.2.0" />
<PackageVersion Include="Serilog.Extensions.Logging" Version="9.0.0" />
Expand Down
15 changes: 13 additions & 2 deletions Examples/UICatalog/Scenarios/CombiningMarks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ public override void Main ()
Application.Top!.SetNeedsDraw ();

var i = -1;
top.AddStr ("Terminal.Gui only supports combining marks that normalize. See Issue #2616.");
top.Move (0, ++i);
top.AddStr ("Terminal.Gui supports all combining sequences that can be rendered as an unique grapheme.");
top.Move (0, ++i);
top.AddStr ("\u0301<- \"\\u0301\" using AddStr.");
top.Move (0, ++i);
Expand All @@ -38,7 +39,7 @@ public override void Main ()
top.AddRune ('\u0301');
top.AddRune ('\u0328');
top.AddRune (']');
top.AddStr ("<- \"[a\\u0301\\u0301\\u0328]\" using AddRune for each.");
top.AddStr ("<- \"[a\\u0301\\u0301\\u0328]\" using AddRune for each. Avoid use AddRune for combining sequences because may result with empty blocks at end.");
top.Move (0, ++i);
top.AddStr ("[a\u0301\u0301\u0328]<- \"[a\\u0301\\u0301\\u0328]\" using AddStr.");
top.Move (0, ++i);
Expand Down Expand Up @@ -82,6 +83,16 @@ public override void Main ()
top.AddStr ("[\U0001F468\U0001F469\U0001F9D2]<- \"[\\U0001F468\\U0001F469\\U0001F9D2]\" using AddStr.");
top.Move (0, ++i);
top.AddStr ("[\U0001F468\u200D\U0001F469\u200D\U0001F9D2]<- \"[\\U0001F468\\u200D\\U0001F469\\u200D\\U0001F9D2]\" using AddStr.");
top.Move (0, ++i);
top.AddStr ("[\U0001F468\u200D\U0001F469\u200D\U0001F467\u200D\U0001F466]<- \"[\\U0001F468\\u200D\\U0001F469\\u200D\\U0001F467\\u200D\\U0001F466]\" using AddStr.");
top.Move (0, ++i);
top.AddStr ("[\u0e32\u0e33]<- \"[\\u0e32\\u0e33]\" using AddStr.");
top.Move (0, ++i);
top.AddStr ("[\U0001F469\u200D\u2764\uFE0F\u200D\U0001F48B\u200D\U0001F468]<- \"[\\U0001F469\\u200D\\u2764\\uFE0F\\u200D\\U0001F48B\\u200D\\U0001F468]\" using AddStr.");
top.Move (0, ++i);
top.AddStr ("[\u0061\uFE20\u0065\uFE21]<- \"[\\u0061\\uFE20\\u0065\\uFE21]\" using AddStr.");
top.Move (0, ++i);
top.AddStr ("[\u1100\uD7B0]<- \"[\\u1100\\uD7B0]\" using AddStr.");
};

Application.Run (top);
Expand Down
2 changes: 1 addition & 1 deletion Examples/UICatalog/Scenarios/LineDrawing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ protected override bool OnDrawingContent ()
SetCurrentAttribute (c.Value.Value.Attribute ?? GetAttributeForRole (VisualRole.Normal));

// TODO: #2616 - Support combining sequences that don't normalize
AddRune (c.Key.X, c.Key.Y, c.Value.Value.Rune);
AddStr (c.Key.X, c.Key.Y, c.Value.Value.Grapheme);
}
}
}
Expand Down
16 changes: 8 additions & 8 deletions Examples/UICatalog/Scenarios/Sliders.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,17 +86,17 @@ public void MakeSliders (View v, List<object> options)
{
if (single.Orientation == Orientation.Horizontal)
{
single.Style.SpaceChar = new () { Rune = Glyphs.HLine };
single.Style.OptionChar = new () { Rune = Glyphs.HLine };
single.Style.SpaceChar = new () { Grapheme = Glyphs.HLine.ToString () };
single.Style.OptionChar = new () { Grapheme = Glyphs.HLine.ToString () };
}
else
{
single.Style.SpaceChar = new () { Rune = Glyphs.VLine };
single.Style.OptionChar = new () { Rune = Glyphs.VLine };
single.Style.SpaceChar = new () { Grapheme = Glyphs.VLine.ToString () };
single.Style.OptionChar = new () { Grapheme = Glyphs.VLine.ToString () };
}
};
single.Style.SetChar = new () { Rune = Glyphs.ContinuousMeterSegment };
single.Style.DragChar = new () { Rune = Glyphs.ContinuousMeterSegment };
single.Style.SetChar = new () { Grapheme = Glyphs.ContinuousMeterSegment.ToString () };
single.Style.DragChar = new () { Grapheme = Glyphs.ContinuousMeterSegment.ToString () };

v.Add (single);

Expand Down Expand Up @@ -257,7 +257,7 @@ public override void Main ()
{
s.Orientation = Orientation.Horizontal;

s.Style.SpaceChar = new () { Rune = Glyphs.HLine };
s.Style.SpaceChar = new () { Grapheme = Glyphs.HLine.ToString () };

if (prev == null)
{
Expand All @@ -275,7 +275,7 @@ public override void Main ()
{
s.Orientation = Orientation.Vertical;

s.Style.SpaceChar = new () { Rune = Glyphs.VLine };
s.Style.SpaceChar = new () { Grapheme = Glyphs.VLine.ToString () };

if (prev == null)
{
Expand Down
11 changes: 4 additions & 7 deletions Examples/UICatalog/Scenarios/SyntaxHighlighting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,12 @@ public override void Main ()
),
null,
new (
"_Load Rune Cells",
"_Load Text Cells",
"",
() => ApplyLoadCells ()
),
new (
"_Save Rune Cells",
"_Save Text Cells",
"",
() => SaveCells ()
),
Expand Down Expand Up @@ -240,12 +240,9 @@ private void ApplyLoadCells ()
{
string csName = color.Key;

foreach (Rune rune in csName.EnumerateRunes ())
{
cells.Add (new () { Rune = rune, Attribute = color.Value.Normal });
}
cells.AddRange (Cell.ToCellList (csName, color.Value.Normal));

cells.Add (new () { Rune = (Rune)'\n', Attribute = color.Value.Focus });
cells.Add (new () { Grapheme = "\n", Attribute = color.Value.Focus });
}

if (File.Exists (_path))
Expand Down
18 changes: 3 additions & 15 deletions Terminal.Gui/App/Application.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,26 +89,14 @@ public static string ToString (IDriver? driver)
{
for (var c = 0; c < driver.Cols; c++)
{
Rune rune = contents [r, c].Rune;
string text = contents [r, c].Grapheme;

if (rune.DecodeSurrogatePair (out char []? sp))
{
sb.Append (sp);
}
else
{
sb.Append ((char)rune.Value);
}
sb.Append (text);

if (rune.GetColumns () > 1)
if (text.GetColumns () > 1)
{
c++;
}

// See Issue #2616
//foreach (var combMark in contents [r, c].CombiningMarks) {
// sb.Append ((char)combMark.Value);
//}
}

sb.AppendLine ();
Expand Down
Loading
Loading