|
@@ -113,7 +113,6 @@ namespace Terminal.Gui {
|
|
ConsoleDriver consoleDriver;
|
|
ConsoleDriver consoleDriver;
|
|
volatile ConsoleKeyInfo [] cki = null;
|
|
volatile ConsoleKeyInfo [] cki = null;
|
|
static volatile bool isEscSeq;
|
|
static volatile bool isEscSeq;
|
|
- int lastWindowHeight;
|
|
|
|
bool stopTasks;
|
|
bool stopTasks;
|
|
#if PROCESS_REQUEST
|
|
#if PROCESS_REQUEST
|
|
bool neededProcessRequest;
|
|
bool neededProcessRequest;
|
|
@@ -251,21 +250,11 @@ namespace Terminal.Gui {
|
|
|
|
|
|
bool IsWinChanged (int winHeight, int winWidth, int buffHeight, int buffWidth)
|
|
bool IsWinChanged (int winHeight, int winWidth, int buffHeight, int buffWidth)
|
|
{
|
|
{
|
|
- if (!consoleDriver.EnableConsoleScrolling) {
|
|
|
|
- if (winWidth != consoleDriver.Cols || winHeight != consoleDriver.Rows) {
|
|
|
|
- var w = Math.Max (winWidth, 0);
|
|
|
|
- var h = Math.Max (winHeight, 0);
|
|
|
|
- GetWindowSizeEvent (new Size (w, h));
|
|
|
|
- return true;
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- if (winWidth != consoleDriver.Cols || winHeight != lastWindowHeight
|
|
|
|
- || buffWidth != consoleDriver.Cols || buffHeight != consoleDriver.Rows) {
|
|
|
|
-
|
|
|
|
- lastWindowHeight = Math.Max (winHeight, 0);
|
|
|
|
- GetWindowSizeEvent (new Size (winWidth, lastWindowHeight));
|
|
|
|
- return true;
|
|
|
|
- }
|
|
|
|
|
|
+ if (winWidth != consoleDriver.Cols || winHeight != consoleDriver.Rows) {
|
|
|
|
+ var w = Math.Max (winWidth, 0);
|
|
|
|
+ var h = Math.Max (winHeight, 0);
|
|
|
|
+ GetWindowSizeEvent (new Size (w, h));
|
|
|
|
+ return true;
|
|
}
|
|
}
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
@@ -584,20 +573,15 @@ namespace Terminal.Gui {
|
|
public override int Rows => rows;
|
|
public override int Rows => rows;
|
|
public override int Left => left;
|
|
public override int Left => left;
|
|
public override int Top => top;
|
|
public override int Top => top;
|
|
|
|
+ [Obsolete ("This API is deprecated", false)]
|
|
public override bool EnableConsoleScrolling { get; set; }
|
|
public override bool EnableConsoleScrolling { get; set; }
|
|
- [Obsolete ("This API is deprecated; use EnableConsoleScrolling instead.", false)]
|
|
|
|
- public override bool HeightAsBuffer {
|
|
|
|
- get => EnableConsoleScrolling;
|
|
|
|
- set => EnableConsoleScrolling = value;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
+ [Obsolete ("This API is deprecated", false)]
|
|
|
|
+ public override bool HeightAsBuffer { get; set; }
|
|
public NetWinVTConsole NetWinConsole { get; }
|
|
public NetWinVTConsole NetWinConsole { get; }
|
|
public bool IsWinPlatform { get; }
|
|
public bool IsWinPlatform { get; }
|
|
public override IClipboard Clipboard { get; }
|
|
public override IClipboard Clipboard { get; }
|
|
public override int [,,] Contents => contents;
|
|
public override int [,,] Contents => contents;
|
|
|
|
|
|
- int largestBufferHeight;
|
|
|
|
-
|
|
|
|
public NetDriver ()
|
|
public NetDriver ()
|
|
{
|
|
{
|
|
var p = Environment.OSVersion.Platform;
|
|
var p = Environment.OSVersion.Platform;
|
|
@@ -752,14 +736,8 @@ namespace Terminal.Gui {
|
|
|
|
|
|
Console.TreatControlCAsInput = true;
|
|
Console.TreatControlCAsInput = true;
|
|
|
|
|
|
- if (EnableConsoleScrolling) {
|
|
|
|
- largestBufferHeight = Console.BufferHeight;
|
|
|
|
- } else {
|
|
|
|
- largestBufferHeight = Console.WindowHeight;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
cols = Console.WindowWidth;
|
|
cols = Console.WindowWidth;
|
|
- rows = largestBufferHeight;
|
|
|
|
|
|
+ rows = Console.WindowHeight;
|
|
|
|
|
|
CurrentAttribute = MakeColor (Color.White, Color.Black);
|
|
CurrentAttribute = MakeColor (Color.White, Color.Black);
|
|
InitalizeColorSchemes ();
|
|
InitalizeColorSchemes ();
|
|
@@ -775,54 +753,31 @@ namespace Terminal.Gui {
|
|
|
|
|
|
public override void ResizeScreen ()
|
|
public override void ResizeScreen ()
|
|
{
|
|
{
|
|
- if (!EnableConsoleScrolling) {
|
|
|
|
- if (Console.WindowHeight > 0) {
|
|
|
|
- // Not supported on Unix.
|
|
|
|
- if (IsWinPlatform) {
|
|
|
|
- // Can raise an exception while is still resizing.
|
|
|
|
- try {
|
|
|
|
-#pragma warning disable CA1416
|
|
|
|
- Console.CursorTop = 0;
|
|
|
|
- Console.CursorLeft = 0;
|
|
|
|
- Console.WindowTop = 0;
|
|
|
|
- Console.WindowLeft = 0;
|
|
|
|
- if (Console.WindowHeight > Rows) {
|
|
|
|
- Console.SetWindowSize (Cols, Rows);
|
|
|
|
- }
|
|
|
|
- Console.SetBufferSize (Cols, Rows);
|
|
|
|
-#pragma warning restore CA1416
|
|
|
|
- } catch (System.IO.IOException) {
|
|
|
|
- setClip ();
|
|
|
|
- } catch (ArgumentOutOfRangeException) {
|
|
|
|
- setClip ();
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- Console.Out.Write ($"\x1b[8;{Rows};{Cols}t");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
|
|
+ if (Console.WindowHeight > 0) {
|
|
|
|
+ // Not supported on Unix.
|
|
if (IsWinPlatform) {
|
|
if (IsWinPlatform) {
|
|
- if (Console.WindowHeight > 0) {
|
|
|
|
- // Can raise an exception while is still resizing.
|
|
|
|
- try {
|
|
|
|
|
|
+ // Can raise an exception while is still resizing.
|
|
|
|
+ try {
|
|
#pragma warning disable CA1416
|
|
#pragma warning disable CA1416
|
|
- Console.CursorTop = 0;
|
|
|
|
- Console.CursorLeft = 0;
|
|
|
|
- if (Console.WindowHeight > Rows) {
|
|
|
|
- Console.SetWindowSize (Cols, Rows);
|
|
|
|
- }
|
|
|
|
- Console.SetBufferSize (Cols, Rows);
|
|
|
|
-#pragma warning restore CA1416
|
|
|
|
- } catch (System.IO.IOException) {
|
|
|
|
- setClip ();
|
|
|
|
- } catch (ArgumentOutOfRangeException) {
|
|
|
|
- setClip ();
|
|
|
|
|
|
+ Console.CursorTop = 0;
|
|
|
|
+ Console.CursorLeft = 0;
|
|
|
|
+ Console.WindowTop = 0;
|
|
|
|
+ Console.WindowLeft = 0;
|
|
|
|
+ if (Console.WindowHeight > Rows) {
|
|
|
|
+ Console.SetWindowSize (Cols, Rows);
|
|
}
|
|
}
|
|
|
|
+ Console.SetBufferSize (Cols, Rows);
|
|
|
|
+#pragma warning restore CA1416
|
|
|
|
+ } catch (System.IO.IOException) {
|
|
|
|
+ setClip ();
|
|
|
|
+ } catch (ArgumentOutOfRangeException) {
|
|
|
|
+ setClip ();
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- Console.Out.Write ($"\x1b[30;{Rows};{Cols}t");
|
|
|
|
|
|
+ Console.Out.Write ($"\x1b[8;{Rows};{Cols}t");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
setClip ();
|
|
setClip ();
|
|
|
|
|
|
void setClip ()
|
|
void setClip ()
|
|
@@ -864,9 +819,7 @@ namespace Terminal.Gui {
|
|
|
|
|
|
public override void UpdateScreen ()
|
|
public override void UpdateScreen ()
|
|
{
|
|
{
|
|
- if (winChanging || Console.WindowHeight < 1 || contents.Length != Rows * Cols * 3
|
|
|
|
- || (!EnableConsoleScrolling && Rows != Console.WindowHeight)
|
|
|
|
- || (EnableConsoleScrolling && Rows != largestBufferHeight)) {
|
|
|
|
|
|
+ if (winChanging || Console.WindowHeight < 1 || contents.Length != Rows * Cols * 3 || Rows != Console.WindowHeight) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1021,23 +974,6 @@ namespace Terminal.Gui {
|
|
|
|
|
|
private void SetWindowPosition (int col, int row)
|
|
private void SetWindowPosition (int col, int row)
|
|
{
|
|
{
|
|
- if (IsWinPlatform && EnableConsoleScrolling) {
|
|
|
|
- var winTop = Math.Max (Rows - Console.WindowHeight - row, 0);
|
|
|
|
- winTop = Math.Min (winTop, Rows - Console.WindowHeight + 1);
|
|
|
|
- winTop = Math.Max (winTop, 0);
|
|
|
|
- if (winTop != Console.WindowTop) {
|
|
|
|
- try {
|
|
|
|
- if (!EnsureBufferSize ()) {
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
-#pragma warning disable CA1416
|
|
|
|
- Console.SetWindowPosition (col, winTop);
|
|
|
|
-#pragma warning restore CA1416
|
|
|
|
- } catch (System.IO.IOException) {
|
|
|
|
-
|
|
|
|
- } catch (System.ArgumentOutOfRangeException) { }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
top = Console.WindowTop;
|
|
top = Console.WindowTop;
|
|
left = Console.WindowLeft;
|
|
left = Console.WindowLeft;
|
|
}
|
|
}
|
|
@@ -1287,15 +1223,10 @@ namespace Terminal.Gui {
|
|
void ChangeWin (Size size)
|
|
void ChangeWin (Size size)
|
|
{
|
|
{
|
|
winChanging = true;
|
|
winChanging = true;
|
|
- if (!EnableConsoleScrolling) {
|
|
|
|
- largestBufferHeight = Math.Max (size.Height, 0);
|
|
|
|
- } else {
|
|
|
|
- largestBufferHeight = Math.Max (size.Height, largestBufferHeight);
|
|
|
|
- }
|
|
|
|
top = 0;
|
|
top = 0;
|
|
left = 0;
|
|
left = 0;
|
|
cols = size.Width;
|
|
cols = size.Width;
|
|
- rows = largestBufferHeight;
|
|
|
|
|
|
+ rows = Math.Max (size.Height, 0);
|
|
ResizeScreen ();
|
|
ResizeScreen ();
|
|
UpdateOffScreen ();
|
|
UpdateOffScreen ();
|
|
winChanging = false;
|
|
winChanging = false;
|