Skip to content

Commit e352dde

Browse files
Copilottig
andauthored
Fixes gui-cs#4151, gui-cs#4152. Remove LineView class and replace all usages with Line (gui-cs#4268)
* Initial plan * Remove LineView and replace all usages with Line - Deleted LineViewExample.cs scenario - Deleted LineViewTests.cs test file - Replaced LineView with Line in all examples (CollectionNavigatorTester, FileDialogExamples, LineExample, Wizard) - Replaced LineView with Line in all tests (ViewTests, TileViewTests) - Changed TileViewLineView to inherit from Line instead of LineView - Removed LineView.cs file - Removed LineView category from TileViewNesting scenario Co-authored-by: tig <585482+tig@users.noreply.github.com> * Remove LineView references from documentation - Updated Line.cs XML documentation to remove comparison with LineView - Removed LineView section from views.md documentation Co-authored-by: tig <585482+tig@users.noreply.github.com> * Fixes Wizard (gui-cs#4269) * fixed Wizard * Made Line use GetAttributeForRole --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: tig <585482+tig@users.noreply.github.com> Co-authored-by: Tig <tig@users.noreply.github.com>
1 parent fc9c40c commit e352dde

File tree

13 files changed

+32
-268
lines changed

13 files changed

+32
-268
lines changed

Examples/UICatalog/Scenarios/CollectionNavigatorTester.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public override void Main ()
129129
_items = new (_items.OrderBy (i => i, StringComparer.OrdinalIgnoreCase));
130130

131131
CreateListView ();
132-
var vsep = new LineView (Orientation.Vertical) { X = Pos.Right (_listView), Y = 1, Height = Dim.Fill () };
132+
var vsep = new Line { Orientation = Orientation.Vertical, X = Pos.Right (_listView), Y = 1, Height = Dim.Fill () };
133133
top.Add (vsep);
134134
CreateTreeView ();
135135

Examples/UICatalog/Scenarios/FileDialogExamples.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public override void Main ()
6262
x = 24;
6363

6464
win.Add (
65-
new LineView (Orientation.Vertical) { X = x++, Y = 1, Height = 4 }
65+
new Line { Orientation = Orientation.Vertical, X = x++, Y = 1, Height = 4 }
6666
);
6767
win.Add (new Label { X = x++, Y = y++, Text = "Caption" });
6868

@@ -74,7 +74,7 @@ public override void Main ()
7474
x = 34;
7575

7676
win.Add (
77-
new LineView (Orientation.Vertical) { X = x++, Y = 1, Height = 4 }
77+
new Line { Orientation = Orientation.Vertical, X = x++, Y = 1, Height = 4 }
7878
);
7979
win.Add (new Label { X = x++, Y = y++, Text = "OpenMode" });
8080

@@ -86,7 +86,7 @@ public override void Main ()
8686
x = 48;
8787

8888
win.Add (
89-
new LineView (Orientation.Vertical) { X = x++, Y = 1, Height = 4 }
89+
new Line { Orientation = Orientation.Vertical, X = x++, Y = 1, Height = 4 }
9090
);
9191
win.Add (new Label { X = x++, Y = y++, Text = "Icons" });
9292

@@ -101,7 +101,7 @@ public override void Main ()
101101
x = 24;
102102

103103
win.Add (
104-
new LineView (Orientation.Vertical) { X = x++, Y = y + 1, Height = 4 }
104+
new Line { Orientation = Orientation.Vertical, X = x++, Y = y + 1, Height = 4 }
105105
);
106106
win.Add (new Label { X = x++, Y = y++, Text = "Allowed" });
107107

@@ -113,7 +113,7 @@ public override void Main ()
113113
x = 45;
114114

115115
win.Add (
116-
new LineView (Orientation.Vertical) { X = x++, Y = y + 1, Height = 4 }
116+
new Line { Orientation = Orientation.Vertical, X = x++, Y = y + 1, Height = 4 }
117117
);
118118
win.Add (new Label { X = x++, Y = y++, Text = "Buttons" });
119119

Examples/UICatalog/Scenarios/LineExample.cs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -203,21 +203,6 @@ public override void Main ()
203203

204204
app.Add (framedView);
205205

206-
// Section 6: Comparison with LineView
207-
var comparisonLabel = new Label
208-
{
209-
X = 35,
210-
Y = 15,
211-
Text = "Line vs LineView Comparison:"
212-
};
213-
app.Add (comparisonLabel);
214-
215-
app.Add (new Label { X = 35, Y = 16, Text = "Line (uses LineCanvas):" });
216-
app.Add (new Line { X = 35, Y = 17, Width = 20, Style = LineStyle.Single });
217-
218-
app.Add (new Label { X = 35, Y = 18, Text = "LineView (direct render):" });
219-
app.Add (new LineView { X = 35, Y = 19, Width = 20 });
220-
221206
// Add help text
222207
var helpLabel = new Label
223208
{

Examples/UICatalog/Scenarios/LineViewExample.cs

Lines changed: 0 additions & 76 deletions
This file was deleted.

Examples/UICatalog/Scenarios/TileViewNesting.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ namespace UICatalog.Scenarios;
44

55
[ScenarioMetadata ("Tile View Nesting", "Demonstrates recursive nesting of TileViews")]
66
[ScenarioCategory ("Controls")]
7-
[ScenarioCategory ("LineView")]
87
public class TileViewNesting : Scenario
98
{
109
private CheckBox _cbBorder;

Terminal.Gui/Views/Line.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@ namespace Terminal.Gui.Views;
88
/// <remarks>
99
/// <para>
1010
/// <see cref="Line"/> is a <see cref="View"/> that renders a single horizontal or vertical line
11-
/// using the <see cref="LineCanvas"/> system. Unlike <see cref="LineView"/>, which directly renders
12-
/// runes, <see cref="Line"/> integrates with the LineCanvas to enable proper box-drawing character
13-
/// selection and line intersection handling.
11+
/// using the <see cref="LineCanvas"/> system. <see cref="Line"/> integrates with the LineCanvas
12+
/// to enable proper box-drawing character selection and line intersection handling.
1413
/// </para>
1514
/// <para>
1615
/// The line's appearance is controlled by the <see cref="Style"/> property, which supports
@@ -232,7 +231,8 @@ protected override bool OnDrawingContent ()
232231
pos,
233232
length,
234233
Orientation,
235-
Style
234+
Style,
235+
GetAttributeForRole(VisualRole.Normal)
236236
);
237237

238238
return true;

Terminal.Gui/Views/LineView.cs

Lines changed: 0 additions & 93 deletions
This file was deleted.

Terminal.Gui/Views/TileView.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -780,7 +780,6 @@ private void Setup (Rectangle viewport)
780780
line.Height = _orientation == Orientation.Vertical
781781
? Dim.Fill ()
782782
: 1;
783-
line.LineRune = _orientation == Orientation.Vertical ? Glyphs.VLine : Glyphs.HLine;
784783

785784
if (_orientation == Orientation.Vertical)
786785
{
@@ -864,7 +863,7 @@ internal string GetTrimmedTitle ()
864863
}
865864
}
866865

867-
private class TileViewLineView : LineView
866+
private class TileViewLineView : Line
868867
{
869868
public Point? moveRuneRenderLocation;
870869

Terminal.Gui/Views/Wizard/Wizard.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ public Wizard ()
7878
IsDefault = true
7979
};
8080

81-
//// Add a horiz separator
82-
var separator = new LineView (Orientation.Horizontal) { Y = Pos.Top (BackButton) - 1 };
81+
// Add a horiz separator
82+
var separator = new Line { Orientation = Orientation.Horizontal, X = -1, Y = Pos.Top (BackButton) - 1, Length = Dim.Fill (-1) };
8383

8484
base.Add (separator);
8585
AddButton (BackButton);
@@ -301,7 +301,7 @@ public bool GoBack ()
301301

302302
if (previous is { })
303303
{
304-
return GoToStep (previous);
304+
return GoToStep (previous);
305305
}
306306

307307
return false;

Tests/UnitTests/View/ViewTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ public void Test_Nested_Views_With_Height_Equal_To_One ()
338338

339339
top.Add (new Label { Text = "111" });
340340
v.Add (top);
341-
v.Add (new LineView (Orientation.Horizontal) { Y = 1 });
341+
v.Add (new Line { Orientation = Orientation.Horizontal, Y = 1 });
342342
bottom.Add (new Label { Text = "222" });
343343
v.Add (bottom);
344344

0 commit comments

Comments
 (0)