Skip to content
Merged
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: 2 additions & 2 deletions Terminal.Gui/View/Frame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ public override void Redraw (Rect bounds)
var borderBounds = new Rect (
screenBounds.X + Math.Max (0, Thickness.Left - 1),
screenBounds.Y + Math.Max (0, Thickness.Top - 1),
screenBounds.Width - Math.Max (0, Math.Max (0, Thickness.Left - 1) - Math.Max (0, Thickness.Right - 1)),
screenBounds.Height - Math.Max (0, Math.Max (0, Thickness.Top - 1) - Math.Max (0, Thickness.Bottom - 1)));
Math.Max (0, screenBounds.Width - Math.Max (0, Math.Max (0, Thickness.Left - 1) + Math.Max (0, Thickness.Right - 1))),
Math.Max (0, screenBounds.Height - Math.Max (0, Math.Max (0, Thickness.Top - 1) + Math.Max (0, Thickness.Bottom - 1))));

var topTitleLineY = borderBounds.Y;
var titleY = borderBounds.Y;
Expand Down
5 changes: 3 additions & 2 deletions Terminal.Gui/View/ViewDrawing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -384,12 +384,13 @@ public virtual void Redraw (Rect bounds)
}
}

// Invoke DrawContentCompleteEvent
OnDrawContentComplete (bounds);
Driver.Clip = prevClip;

OnRenderLineCanvas ();

// Invoke DrawContentCompleteEvent
OnDrawContentComplete (bounds);

// BUGBUG: v2 - We should be able to use View.SetClip here and not have to resort to knowing Driver details.
ClearLayoutNeeded ();
ClearNeedsDisplay ();
Expand Down
3 changes: 1 addition & 2 deletions Terminal.Gui/Views/Menu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,6 @@ internal Attribute DetermineColorSchemeFor (MenuItem item, int index)

public override void Redraw (Rect bounds)
{

if (barItems.Children == null) {
return;
}
Expand All @@ -547,6 +546,7 @@ public override void Redraw (Rect bounds)
Driver.SetAttribute (GetNormalColor ());

OnDrawFrames ();
OnRenderLineCanvas ();

for (int i = Bounds.Y; i < barItems.Children.Length; i++) {
if (i < 0)
Expand Down Expand Up @@ -646,7 +646,6 @@ public override void Redraw (Rect bounds)
}
Driver.Clip = savedClip;

OnRenderLineCanvas ();
PositionCursor ();
}

Expand Down
158 changes: 79 additions & 79 deletions UnitTests/Views/ContextMenuTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -904,84 +904,84 @@ public void Key_Open_And_Close_The_ContextMenu ()
}

// BUGBUG: Broke this test with #2483 - @bdisp I need your help figuring out why
// [Fact, AutoInitShutdown]
// public void Draw_A_ContextManu_Over_A_Dialog ()
// {
// var top = Application.Top;
// var win = new Window ();
// top.Add (win);
// Application.Begin (top);
// ((FakeDriver)Application.Driver).SetBufferSize (20, 15);

// Assert.Equal (new Rect (0, 0, 20, 15), win.Frame);
// TestHelpers.AssertDriverContentsWithFrameAre (@"
//┌──────────────────┐
//│ │
//│ │
//│ │
//│ │
//│ │
//│ │
//│ │
//│ │
//│ │
//│ │
//│ │
//│ │
//│ │
//└──────────────────┘", output);

// var dialog = new Dialog () { X = 2, Y = 2, Width = 15, Height = 4 };
// dialog.Add (new TextField ("Test") { X = Pos.Center (), Width = 10 });
// var rs = Application.Begin (dialog);

// Assert.Equal (new Rect (2, 2, 15, 4), dialog.Frame);
// TestHelpers.AssertDriverContentsWithFrameAre (@"
//┌──────────────────┐
//│ │
//│ ┌─────────────┐ │
//│ │ Test │ │
//│ │ │ │
//│ └─────────────┘ │
//│ │
//│ │
//│ │
//│ │
//│ │
//│ │
//│ │
//│ │
//└──────────────────┘", output);

// ReflectionTools.InvokePrivate (
// typeof (Application),
// "ProcessMouseEvent",
// new MouseEvent () {
// X = 9,
// Y = 3,
// Flags = MouseFlags.Button3Clicked
// });

// var firstIteration = false;
// Application.RunMainLoopIteration (ref rs, true, ref firstIteration);
// TestHelpers.AssertDriverContentsWithFrameAre (@"
//┌──────────────────┐
//│ │
//│ ┌─────────────┐ │
//│ │ Test │ │
//┌───────────────────
//│ Select All Ctrl+
//│ Delete All Ctrl+
//│ Copy Ctrl+
//│ Cut Ctrl+
//│ Paste Ctrl+
//│ Undo Ctrl+
//│ Redo Ctrl+
//└───────────────────
//│ │
//└──────────────────┘", output);

// Application.End (rs);
// }
[Fact, AutoInitShutdown]
public void Draw_A_ContextManu_Over_A_Dialog ()
{
var top = Application.Top;
var win = new Window ();
top.Add (win);
Application.Begin (top);
((FakeDriver)Application.Driver).SetBufferSize (20, 15);

Assert.Equal (new Rect (0, 0, 20, 15), win.Frame);
TestHelpers.AssertDriverContentsWithFrameAre (@"
┌──────────────────┐
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
└──────────────────┘", output);

var dialog = new Dialog () { X = 2, Y = 2, Width = 15, Height = 4 };
dialog.Add (new TextField ("Test") { X = Pos.Center (), Width = 10 });
var rs = Application.Begin (dialog);

Assert.Equal (new Rect (2, 2, 15, 4), dialog.Frame);
TestHelpers.AssertDriverContentsWithFrameAre (@"
┌──────────────────┐
│ │
│ ┌─────────────┐ │
│ │ Test │ │
│ │ │ │
│ └─────────────┘ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
└──────────────────┘", output);

ReflectionTools.InvokePrivate (
typeof (Application),
"ProcessMouseEvent",
new MouseEvent () {
X = 9,
Y = 3,
Flags = MouseFlags.Button3Clicked
});

var firstIteration = false;
Application.RunMainLoopIteration (ref rs, true, ref firstIteration);
TestHelpers.AssertDriverContentsWithFrameAre (@"
┌──────────────────┐
│ │
│ ┌─────────────┐ │
│ │ Test │ │
┌───────────────────
│ Select All Ctrl+
│ Delete All Ctrl+
│ Copy Ctrl+
│ Cut Ctrl+
│ Paste Ctrl+
│ Undo Ctrl+
│ Redo Ctrl+
└───────────────────
│ │
└──────────────────┘", output);

Application.End (rs);
}
}
}
2 changes: 1 addition & 1 deletion UnitTests/Views/MenuTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1848,7 +1848,7 @@ public void Menu_With_Separator ()
File
┌────────────────────────────┐
│ Open Open a file Ctrl+O │
────────────────────────────
────────────────────────────
│ Quit │
└────────────────────────────┘", output);
}
Expand Down
Loading