mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +01:00
merged
This commit is contained in:
@@ -1173,6 +1173,7 @@ namespace Terminal.Gui {
|
||||
_initialized = false;
|
||||
mouseGrabView = null;
|
||||
_enableConsoleScrolling = false;
|
||||
lastMouseOwnerView = null;
|
||||
|
||||
// Reset synchronization context to allow the user to run async/await,
|
||||
// as the main loop has been ended, the synchronization context from
|
||||
@@ -1280,6 +1281,15 @@ namespace Terminal.Gui {
|
||||
}
|
||||
state.Toplevel.SetNeedsDisplay (state.Toplevel.Bounds);
|
||||
}
|
||||
if (toplevels.Count == 1 && state.Toplevel == Top
|
||||
&& (Driver.Cols != state.Toplevel.Frame.Width || Driver.Rows != state.Toplevel.Frame.Height)
|
||||
&& (!state.Toplevel.NeedDisplay.IsEmpty || state.Toplevel.ChildNeedsDisplay || state.Toplevel.LayoutNeeded)) {
|
||||
|
||||
Driver.SetAttribute (Colors.TopLevel.Normal);
|
||||
state.Toplevel.Clear (new Rect (0, 0, Driver.Cols, Driver.Rows));
|
||||
|
||||
}
|
||||
|
||||
if (!state.Toplevel._needsDisplay.IsEmpty || state.Toplevel._childNeedsDisplay || state.Toplevel.LayoutNeeded
|
||||
|| MdiChildNeedsDisplay ()) {
|
||||
state.Toplevel.Redraw (state.Toplevel.Bounds);
|
||||
|
||||
@@ -327,8 +327,8 @@ namespace UICatalog.Scenarios {
|
||||
};
|
||||
Add (listView);
|
||||
|
||||
start = new Button ("Start") { IsDefault = true };
|
||||
start.Clicked += (s,e) => {
|
||||
start = new Button ("Start") { IsDefault = true, ClearOnVisibleFalse = false };
|
||||
start.Clicked += (s, e) => {
|
||||
Staging = new Staging (DateTime.Now);
|
||||
RequestStop ();
|
||||
};
|
||||
|
||||
@@ -1364,5 +1364,90 @@ namespace Terminal.Gui.TopLevelTests {
|
||||
|
||||
CTRL-N New", output);
|
||||
}
|
||||
|
||||
[Fact, AutoInitShutdown]
|
||||
public void Single_Smaller_Top_Will_Have_Cleaning_Trails_Chunk_On_Move ()
|
||||
{
|
||||
var dialog = new Dialog ("Single smaller Dialog") { Width = 30, Height = 10 };
|
||||
dialog.Add (new Label (
|
||||
"How should I've to react. Cleaning all chunk trails or setting the 'Cols' and 'Rows' to this dialog length?\n" +
|
||||
"Cleaning is more easy to fix this.") {
|
||||
X = Pos.Center (),
|
||||
Y = Pos.Center (),
|
||||
Width = Dim.Fill (),
|
||||
Height = Dim.Fill (),
|
||||
TextAlignment = TextAlignment.Centered,
|
||||
VerticalTextAlignment = VerticalTextAlignment.Middle,
|
||||
AutoSize = false
|
||||
});
|
||||
|
||||
var rs = Application.Begin (dialog);
|
||||
|
||||
Assert.Null (Application.MouseGrabView);
|
||||
Assert.Equal (new Rect (25, 7, 30, 10), dialog.Frame);
|
||||
TestHelpers.AssertDriverContentsWithFrameAre (@"
|
||||
┌ Single smaller Dialog ─────┐
|
||||
│ How should I've to react. │
|
||||
│Cleaning all chunk trails or│
|
||||
│ setting the 'Cols' and │
|
||||
│ 'Rows' to this dialog │
|
||||
│ length? │
|
||||
│Cleaning is more easy to fix│
|
||||
│ this. │
|
||||
│ │
|
||||
└────────────────────────────┘", output);
|
||||
|
||||
ReflectionTools.InvokePrivate (
|
||||
typeof (Application),
|
||||
"ProcessMouseEvent",
|
||||
new MouseEvent () {
|
||||
X = 25,
|
||||
Y = 7,
|
||||
Flags = MouseFlags.Button1Pressed
|
||||
});
|
||||
|
||||
var firstIteration = false;
|
||||
Application.RunMainLoopIteration (ref rs, true, ref firstIteration); Assert.Equal (dialog, Application.MouseGrabView);
|
||||
|
||||
Assert.Equal (new Rect (25, 7, 30, 10), dialog.Frame);
|
||||
TestHelpers.AssertDriverContentsWithFrameAre (@"
|
||||
┌ Single smaller Dialog ─────┐
|
||||
│ How should I've to react. │
|
||||
│Cleaning all chunk trails or│
|
||||
│ setting the 'Cols' and │
|
||||
│ 'Rows' to this dialog │
|
||||
│ length? │
|
||||
│Cleaning is more easy to fix│
|
||||
│ this. │
|
||||
│ │
|
||||
└────────────────────────────┘", output);
|
||||
|
||||
ReflectionTools.InvokePrivate (
|
||||
typeof (Application),
|
||||
"ProcessMouseEvent",
|
||||
new MouseEvent () {
|
||||
X = 20,
|
||||
Y = 10,
|
||||
Flags = MouseFlags.Button1Pressed | MouseFlags.ReportMousePosition
|
||||
});
|
||||
|
||||
firstIteration = false;
|
||||
Application.RunMainLoopIteration (ref rs, true, ref firstIteration);
|
||||
Assert.Equal (dialog, Application.MouseGrabView);
|
||||
Assert.Equal (new Rect (20, 10, 30, 10), dialog.Frame);
|
||||
TestHelpers.AssertDriverContentsWithFrameAre (@"
|
||||
┌ Single smaller Dialog ─────┐
|
||||
│ How should I've to react. │
|
||||
│Cleaning all chunk trails or│
|
||||
│ setting the 'Cols' and │
|
||||
│ 'Rows' to this dialog │
|
||||
│ length? │
|
||||
│Cleaning is more easy to fix│
|
||||
│ this. │
|
||||
│ │
|
||||
└────────────────────────────┘", output);
|
||||
|
||||
Application.End (rs);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user