diff --git a/Terminal.Gui/Drawing/LineCanvas.cs b/Terminal.Gui/Drawing/LineCanvas.cs
index 9d18a9f2e..aa7691368 100644
--- a/Terminal.Gui/Drawing/LineCanvas.cs
+++ b/Terminal.Gui/Drawing/LineCanvas.cs
@@ -158,13 +158,19 @@ public class LineCanvas : IDisposable
{
_cachedViewport = Rectangle.Empty;
_lines.Clear ();
- Exclusions.Clear ();
+ _exclusionRegion = null;
}
+ private Region? _exclusionRegion;
+
///
/// Gets the list of locations that will be excluded from and .
///
- public List Exclusions { get; } = new List ();
+ public void Exclude (Region region)
+ {
+ _exclusionRegion ??= new Region ();
+ _exclusionRegion.Union (region);
+ }
///
/// Clears any cached states from the canvas Call this method if you make changes to lines that have already been
@@ -194,10 +200,9 @@ public class LineCanvas : IDisposable
Cell? cell = GetCellForIntersects (Application.Driver, intersects);
- Point location = new (x, y);
- if (cell is { } && !Exclusions.Contains (location))
+ if (cell is { } && _exclusionRegion?.Contains (x, y) is null or false)
{
- map.Add (location, cell);
+ map.Add (new (x, y), cell);
}
}
}
@@ -230,8 +235,7 @@ public class LineCanvas : IDisposable
Rune? rune = GetRuneForIntersects (Application.Driver, intersects);
- Point location = new (x, y);
- if (rune is { } && !Exclusions.Contains (location))
+ if (rune is { } && _exclusionRegion?.Contains (x, y) is null or false)
{
map.Add (new (x, y), rune.Value);
}
@@ -257,7 +261,12 @@ public class LineCanvas : IDisposable
{
AddLine (line);
}
- Exclusions.AddRange (lineCanvas.Exclusions);
+
+ if (lineCanvas._exclusionRegion is { })
+ {
+ _exclusionRegion ??= new ();
+ _exclusionRegion.Union (lineCanvas._exclusionRegion);
+ }
}
/// Removes the last line added to the canvas
diff --git a/Terminal.Gui/View/Adornment/Border.cs b/Terminal.Gui/View/Adornment/Border.cs
index f41c029a9..5d5199048 100644
--- a/Terminal.Gui/View/Adornment/Border.cs
+++ b/Terminal.Gui/View/Adornment/Border.cs
@@ -106,7 +106,6 @@ public class Border : Adornment
{
DrawIndicator.AdvanceAnimation (false);
DrawIndicator.Render ();
- Parent?.LineCanvas.Exclusions.Add (DrawIndicator.ViewportToScreen (new Point (0,0)));
}
}
diff --git a/Terminal.Gui/View/View.Drawing.cs b/Terminal.Gui/View/View.Drawing.cs
index 9e431f81b..a07ce49c8 100644
--- a/Terminal.Gui/View/View.Drawing.cs
+++ b/Terminal.Gui/View/View.Drawing.cs
@@ -133,6 +133,7 @@ public partial class View // Drawing APIs
foreach (View subview in Border.Subviews)
{
subview.SetNeedsDraw ();
+ LineCanvas.Exclude (new (subview.FrameToScreen()));
}
Region? saved = Border?.ClipFrame ();
diff --git a/Terminal.Gui/Views/Slider.cs b/Terminal.Gui/Views/Slider.cs
index fbd08e0b9..27d17fa6b 100644
--- a/Terminal.Gui/Views/Slider.cs
+++ b/Terminal.Gui/Views/Slider.cs
@@ -850,8 +850,8 @@ public class Slider : View, IOrientation
if (IsInitialized)
{
- normalAttr = ColorScheme?.Normal ?? Application.Top.ColorScheme.Normal;
- setAttr = Style.SetChar.Attribute ?? ColorScheme!.HotNormal;
+ normalAttr = GetNormalColor();
+ setAttr = Style.SetChar.Attribute ?? GetHotNormalColor ();
}
bool isVertical = _config._sliderOrientation == Orientation.Vertical;
@@ -1058,8 +1058,8 @@ public class Slider : View, IOrientation
if (IsInitialized)
{
- normalAttr = Style.LegendAttributes.NormalAttribute ?? ColorScheme?.Normal ?? ColorScheme.Disabled;
- setAttr = Style.LegendAttributes.SetAttribute ?? ColorScheme?.HotNormal ?? ColorScheme.Normal;
+ normalAttr = Style.LegendAttributes.NormalAttribute ?? GetNormalColor ();
+ setAttr = Style.LegendAttributes.SetAttribute ?? GetHotNormalColor ();
spaceAttr = Style.LegendAttributes.EmptyAttribute ?? normalAttr;
}
diff --git a/UICatalog/Scenarios/AllViewsTester.cs b/UICatalog/Scenarios/AllViewsTester.cs
index 28fbd6eea..836ad72e0 100644
--- a/UICatalog/Scenarios/AllViewsTester.cs
+++ b/UICatalog/Scenarios/AllViewsTester.cs
@@ -60,7 +60,7 @@ public class AllViewsTester : Scenario
SelectedItem = 0,
Source = new ListWrapper (new (_viewClasses.Keys.ToList ())),
BorderStyle = LineStyle.Rounded,
- SuperViewRendersLineCanvas = true
+ //SuperViewRendersLineCanvas = true
};
_classListView.SelectedItemChanged += (s, args) =>
@@ -88,7 +88,7 @@ public class AllViewsTester : Scenario
_adornmentsEditor = new ()
{
Title = "Adornments [_2]",
- X = Pos.Right (_classListView) - 1,
+ X = Pos.Right (_classListView),
Y = 0,
Width = Dim.Auto (),
Height = Dim.Auto (),
@@ -96,22 +96,22 @@ public class AllViewsTester : Scenario
BorderStyle = LineStyle.Rounded,
AutoSelectViewToEdit = false,
AutoSelectAdornments = false,
- SuperViewRendersLineCanvas = true
+ //SuperViewRendersLineCanvas = true
};
_adornmentsEditor.ExpanderButton.Orientation = Orientation.Vertical;
_arrangementEditor = new ()
{
Title = "Arrangement [_3]",
- X = Pos.Right (_classListView) - 1,
- Y = Pos.Bottom (_adornmentsEditor) -1,
+ X = Pos.Right (_classListView),
+ Y = Pos.Bottom (_adornmentsEditor),
Width = Dim.Width (_adornmentsEditor),
Height = Dim.Fill (),
ColorScheme = Colors.ColorSchemes ["TopLevel"],
BorderStyle = LineStyle.Rounded,
AutoSelectViewToEdit = false,
AutoSelectAdornments = false,
- SuperViewRendersLineCanvas = true
+ //SuperViewRendersLineCanvas = true
};
_arrangementEditor.ExpanderButton.Orientation = Orientation.Vertical;
diff --git a/UICatalog/Scenarios/Editors/AdornmentsEditor.cs b/UICatalog/Scenarios/Editors/AdornmentsEditor.cs
index 1515f78fb..8193d5b64 100644
--- a/UICatalog/Scenarios/Editors/AdornmentsEditor.cs
+++ b/UICatalog/Scenarios/Editors/AdornmentsEditor.cs
@@ -27,6 +27,8 @@ public class AdornmentsEditor : EditorBase
///
protected override void OnViewToEditChanged ()
{
+ Enabled = ViewToEdit is Adornment;
+
if (MarginEditor is { })
{
MarginEditor.AdornmentToEdit = ViewToEdit?.Margin ?? null;
diff --git a/UICatalog/Scenarios/Editors/ArrangementEditor.cs b/UICatalog/Scenarios/Editors/ArrangementEditor.cs
index 0b6bc982c..cdd7287a8 100644
--- a/UICatalog/Scenarios/Editors/ArrangementEditor.cs
+++ b/UICatalog/Scenarios/Editors/ArrangementEditor.cs
@@ -69,6 +69,8 @@ public sealed class ArrangementEditor : EditorBase
protected override void OnViewToEditChanged ()
{
+ Enabled = ViewToEdit is not Adornment;
+
_arrangementSlider.OptionsChanged -= ArrangementSliderOnOptionsChanged;
// Set the appropriate options in the slider based on _viewToEdit.Arrangement
diff --git a/UICatalog/Scenarios/Editors/LayoutEditor.cs b/UICatalog/Scenarios/Editors/LayoutEditor.cs
index a7aed7d6d..e64d8664d 100644
--- a/UICatalog/Scenarios/Editors/LayoutEditor.cs
+++ b/UICatalog/Scenarios/Editors/LayoutEditor.cs
@@ -29,6 +29,7 @@ public class LayoutEditor : EditorBase
protected override void OnViewToEditChanged ()
{
+ Enabled = ViewToEdit is not Adornment;
if (_xEditor is { })
{