diff --git a/Terminal.Gui/ConsoleDrivers/CursesDriver/CursesDriver.cs b/Terminal.Gui/ConsoleDrivers/CursesDriver/CursesDriver.cs
index e430f4da1..759476388 100644
--- a/Terminal.Gui/ConsoleDrivers/CursesDriver/CursesDriver.cs
+++ b/Terminal.Gui/ConsoleDrivers/CursesDriver/CursesDriver.cs
@@ -20,7 +20,7 @@ namespace Terminal.Gui {
public override int Cols => Curses.Cols;
public override int Rows => Curses.Lines;
public override int Top => 0;
- public override HeightSize HeightSize { get; set; }
+ public override bool HeightAsBuffer { get; set; }
// Current row, and current col, tracked by Move/AddRune only
int ccol, crow;
diff --git a/Terminal.Gui/ConsoleDrivers/FakeDriver/FakeDriver.cs b/Terminal.Gui/ConsoleDrivers/FakeDriver/FakeDriver.cs
index 424e1def0..c5a611fe7 100644
--- a/Terminal.Gui/ConsoleDrivers/FakeDriver/FakeDriver.cs
+++ b/Terminal.Gui/ConsoleDrivers/FakeDriver/FakeDriver.cs
@@ -20,7 +20,7 @@ namespace Terminal.Gui {
public override int Cols => cols;
public override int Rows => rows;
public override int Top => 0;
- public override HeightSize HeightSize { get; set; }
+ public override bool HeightAsBuffer { get; set; }
// The format is rows, columns and 3 values on the last column: Rune, Attribute and Dirty Flag
int [,,] contents;
diff --git a/Terminal.Gui/ConsoleDrivers/NetDriver.cs b/Terminal.Gui/ConsoleDrivers/NetDriver.cs
index 2efb3d12d..cf3d88f58 100644
--- a/Terminal.Gui/ConsoleDrivers/NetDriver.cs
+++ b/Terminal.Gui/ConsoleDrivers/NetDriver.cs
@@ -18,7 +18,7 @@ namespace Terminal.Gui {
public override int Cols => cols;
public override int Rows => rows;
public override int Top => top;
- public override HeightSize HeightSize { get; set; }
+ public override bool HeightAsBuffer { get; set; }
// The format is rows, columns and 3 values on the last column: Rune, Attribute and Dirty Flag
int [,,] contents;
@@ -149,8 +149,7 @@ namespace Terminal.Gui {
void ResizeScreen ()
{
- switch (HeightSize) {
- case HeightSize.WindowHeight:
+ if (!HeightAsBuffer) {
if (Console.WindowHeight > 0) {
// Can raise an exception while is still resizing.
try {
@@ -174,8 +173,7 @@ namespace Terminal.Gui {
return;
}
}
- break;
- case HeightSize.BufferHeight:
+ } else {
if (isWinPlatform && Console.WindowHeight > 0) {
// Can raise an exception while is still resizing.
try {
@@ -189,8 +187,8 @@ namespace Terminal.Gui {
Console.Out.Write ($"\x1b[{top};{Console.WindowLeft}" +
$";{Rows};{Cols}w");
}
- break;
}
+
Clip = new Rect (0, 0, Cols, Rows);
contents = new int [Rows, Cols, 3];
@@ -240,8 +238,8 @@ namespace Terminal.Gui {
public override void UpdateScreen ()
{
if (winChanging || Console.WindowHeight == 0
- || (HeightSize == HeightSize.WindowHeight && Rows != Console.WindowHeight)
- || (HeightSize == HeightSize.BufferHeight && Rows != Console.BufferHeight)) {
+ || (!HeightAsBuffer && Rows != Console.WindowHeight)
+ || (HeightAsBuffer && Rows != Console.BufferHeight)) {
return;
}
@@ -467,16 +465,13 @@ namespace Terminal.Gui {
winChanging = true;
const int Min_WindowWidth = 14;
Size size = new Size ();
- switch (HeightSize) {
- case HeightSize.WindowHeight:
+ if (!HeightAsBuffer) {
size = new Size (Math.Max (Min_WindowWidth, Console.WindowWidth),
Console.WindowHeight);
top = 0;
- break;
- case HeightSize.BufferHeight:
+ } else {
size = new Size (Console.BufferWidth, Console.BufferHeight);
top = e;
- break;
}
cols = size.Width;
rows = size.Height;
@@ -579,13 +574,11 @@ namespace Terminal.Gui {
void WaitWinChange ()
{
while (true) {
- switch (consoleDriver.HeightSize) {
- case HeightSize.WindowHeight:
+ if (!consoleDriver.HeightAsBuffer) {
if (Console.WindowWidth != consoleDriver.Cols || Console.WindowHeight != consoleDriver.Rows) {
return;
}
- break;
- case HeightSize.BufferHeight:
+ } else {
if (Console.BufferWidth != consoleDriver.Cols || Console.BufferHeight != consoleDriver.Rows
|| Console.WindowTop != consoleDriver.Top
|| Console.WindowHeight != lastWindowHeight) {
diff --git a/Terminal.Gui/ConsoleDrivers/WindowsDriver.cs b/Terminal.Gui/ConsoleDrivers/WindowsDriver.cs
index 76f3288b3..be4455520 100644
--- a/Terminal.Gui/ConsoleDrivers/WindowsDriver.cs
+++ b/Terminal.Gui/ConsoleDrivers/WindowsDriver.cs
@@ -523,7 +523,7 @@ namespace Terminal.Gui {
public override int Cols => cols;
public override int Rows => rows;
public override int Top => top;
- public override HeightSize HeightSize { get; set; }
+ public override bool HeightAsBuffer { get; set; }
public WindowsConsole WinConsole {
get => winConsole;
@@ -1334,14 +1334,12 @@ namespace Terminal.Gui {
void WaitWinChange ()
{
while (true) {
- switch (consoleDriver.HeightSize) {
- case HeightSize.WindowHeight:
+ if (!consoleDriver.HeightAsBuffer) {
if (Console.WindowWidth != consoleDriver.Cols || Console.WindowHeight != consoleDriver.Rows
|| Console.WindowTop != consoleDriver.Top) { // Top only working on Windows.
return;
}
- break;
- case HeightSize.BufferHeight:
+ } else {
if (Console.BufferWidth != consoleDriver.Cols || Console.BufferHeight != consoleDriver.Rows) {
return;
}
diff --git a/Terminal.Gui/Core/Application.cs b/Terminal.Gui/Core/Application.cs
index d30bf1b94..0e7e474ae 100644
--- a/Terminal.Gui/Core/Application.cs
+++ b/Terminal.Gui/Core/Application.cs
@@ -79,21 +79,21 @@ namespace Terminal.Gui {
public static View CurrentView { get; set; }
///
- /// The current used in the terminal.
+ /// The current used in the terminal.
///
- public static HeightSize HeightSize {
+ public static bool HeightAsBuffer {
get {
if (Driver == null) {
throw new ArgumentNullException ("The driver must be initialized first.");
}
- return Driver.HeightSize;
+ return Driver.HeightAsBuffer;
}
set {
if (Driver == null) {
throw new ArgumentNullException ("The driver must be initialized first.");
}
- if (Driver.HeightSize != value) {
- Driver.HeightSize = value;
+ if (Driver.HeightAsBuffer != value) {
+ Driver.HeightAsBuffer = value;
Driver.Refresh ();
}
}
diff --git a/Terminal.Gui/Core/ConsoleDriver.cs b/Terminal.Gui/Core/ConsoleDriver.cs
index 68cfb1dc2..1f618e5d7 100644
--- a/Terminal.Gui/Core/ConsoleDriver.cs
+++ b/Terminal.Gui/Core/ConsoleDriver.cs
@@ -458,20 +458,6 @@ namespace Terminal.Gui {
public static Dictionary ColorSchemes { get; }
}
- ///
- /// The visible height should be used on the window.
- ///
- public enum HeightSize {
- ///
- /// Only window height will be visible not allowing scroll.
- ///
- WindowHeight,
- ///
- /// All buffer height will be visible allowing scroll.
- ///
- BufferHeight
- }
-
/////
///// Special characters that can be drawn with
/////
@@ -561,9 +547,10 @@ namespace Terminal.Gui {
public abstract int Top { get; }
///
- /// The current used in the terminal.
+ /// If false height is measured by the window height and thus no scrolling.
+ /// If true then height is measured by the buffer height, enabling scrolling.
///
- public abstract HeightSize HeightSize { get; set; }
+ public abstract bool HeightAsBuffer { get; set; }
///
/// Initializes the driver