Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 1 addition & 3 deletions Terminal.Gui/Core/TextFormatter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1190,9 +1190,7 @@ public void Draw (Rect bounds, Attribute normalColor, Attribute hotColor, Rect c
for (int line = 0; line < linesFormated.Count; line++) {
if ((isVertical && line > bounds.Width) || (!isVertical && line > bounds.Height))
continue;
if ((isVertical && line >= maxBounds.Left + maxBounds.Width - 1)
|| (!isVertical && line >= maxBounds.Top + maxBounds.Height - 1))

if ((isVertical && line > maxBounds.Left + maxBounds.Width - bounds.X) || (!isVertical && line > maxBounds.Top + maxBounds.Height - bounds.Y))
break;

var runes = lines [line].ToRunes ();
Expand Down
26 changes: 11 additions & 15 deletions Terminal.Gui/Core/View.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1105,8 +1105,15 @@ public void BringSubviewForward (View subview)
/// </remarks>
public void Clear ()
{
var h = Frame.Height;
var w = Frame.Width;
Rect containerBounds = GetContainerBounds ();
Rect viewBounds = Bounds;
if (!containerBounds.IsEmpty) {
viewBounds.Width = Math.Min (viewBounds.Width, containerBounds.Width);
viewBounds.Height = Math.Min (viewBounds.Height, containerBounds.Height);
}

var h = viewBounds.Height;
var w = viewBounds.Width;
for (var line = 0; line < h; line++) {
Move (0, line);
for (var col = 0; col < w; col++)
Expand Down Expand Up @@ -1518,13 +1525,13 @@ public virtual void Redraw (Rect bounds)
}

if (!ustring.IsNullOrEmpty (TextFormatter.Text)) {
Rect containerBounds = GetContainerBounds ();
Clear (ViewToScreen (GetNeedDisplay (containerBounds)));
Clear ();
SetChildNeedsDisplay ();
// Draw any Text
if (TextFormatter != null) {
TextFormatter.NeedsFormat = true;
}
Rect containerBounds = GetContainerBounds ();
TextFormatter?.Draw (ViewToScreen (Bounds), HasFocus ? ColorScheme.Focus : GetNormalColor (),
HasFocus ? ColorScheme.HotFocus : Enabled ? ColorScheme.HotNormal : ColorScheme.Disabled,
containerBounds);
Expand Down Expand Up @@ -1562,17 +1569,6 @@ public virtual void Redraw (Rect bounds)
ClearNeedsDisplay ();
}

Rect GetNeedDisplay (Rect containerBounds)
{
Rect rect = NeedDisplay;
if (!containerBounds.IsEmpty) {
rect.Width = Math.Min (NeedDisplay.Width, containerBounds.Width);
rect.Height = Math.Min (NeedDisplay.Height, containerBounds.Height);
}

return rect;
}

Rect GetContainerBounds ()
{
var containerBounds = SuperView == null ? default : SuperView.ViewToScreen (SuperView.Bounds);
Expand Down
313 changes: 0 additions & 313 deletions UICatalog/Scenarios/ASCIICustomButton.cs

This file was deleted.

Loading