Skip to content

Commit

Permalink
Revert "Illustrates gui-cs#2331 (Scrollview not respecting clip) does…
Browse files Browse the repository at this point in the history
… not reproduce (gui-cs#2332)"

This reverts commit c85ff95.
  • Loading branch information
tig authored and BDisp committed Feb 27, 2023
1 parent 1d2dc40 commit 28d7be7
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 617 deletions.
25 changes: 10 additions & 15 deletions Terminal.Gui/Core/View.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1109,8 +1109,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 @@ -1524,8 +1531,7 @@ 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) {
Expand Down Expand Up @@ -1568,17 +1574,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

0 comments on commit 28d7be7

Please sign in to comment.