From 06960ca1f0f6c385aed6971e5cf25553d4582b5c Mon Sep 17 00:00:00 2001 From: BDisp Date: Mon, 14 Aug 2023 20:02:10 +0100 Subject: [PATCH] Revert "Fix a bug where a row is less than zero on shrinking." This reverts commit f6e5c7be85c96166adc7ae2e0da2b36865c221d1. --- Terminal.Gui/Core/Border.cs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/Terminal.Gui/Core/Border.cs b/Terminal.Gui/Core/Border.cs index 8dac63c46..abf4438ce 100644 --- a/Terminal.Gui/Core/Border.cs +++ b/Terminal.Gui/Core/Border.cs @@ -445,10 +445,12 @@ namespace Terminal.Gui { private void Parent_Removed (View obj) { - if (borderBrush != null) { + if (borderBrush != null) + { BorderBrush = default; } - if (background != null) { + if (background != null) + { Background = default; } child.Removed -= Parent_Removed; @@ -798,7 +800,7 @@ namespace Terminal.Gui { SetBorderBrush (driver); // Draw the upper BorderThickness - for (int r = Math.Max (frame.Y, 0); + for (int r = frame.Y; r < Math.Min (frame.Y + borderThickness.Top, frame.Bottom); r++) { for (int c = frame.X; c < Math.Min (frame.Right, driver.Cols); c++) { @@ -808,7 +810,7 @@ namespace Terminal.Gui { } // Draw the left BorderThickness - for (int r = Math.Max (Math.Min (frame.Y + borderThickness.Top, frame.Bottom), 0); + for (int r = Math.Min (frame.Y + borderThickness.Top, frame.Bottom); r < Math.Min (frame.Bottom - borderThickness.Bottom, driver.Rows); r++) { for (int c = frame.X; c < Math.Min (frame.X + borderThickness.Left, frame.Right); c++) { @@ -818,7 +820,7 @@ namespace Terminal.Gui { } // Draw the right BorderThickness - for (int r = Math.Max (Math.Min (frame.Y + borderThickness.Top, frame.Bottom), 0); + for (int r = Math.Min (frame.Y + borderThickness.Top, frame.Bottom); r < Math.Min (frame.Bottom - borderThickness.Bottom, driver.Rows); r++) { for (int c = Math.Max (frame.Right - borderThickness.Right, frame.X); c < Math.Min (frame.Right, driver.Cols); c++) { @@ -840,7 +842,7 @@ namespace Terminal.Gui { SetBackground (driver); // Draw the upper Padding - for (int r = Math.Max (frame.Y + borderThickness.Top, 0); + for (int r = frame.Y + borderThickness.Top; r < Math.Min (frame.Y + sumThickness.Top, frame.Bottom - borderThickness.Bottom); r++) { for (int c = frame.X + borderThickness.Left; c < Math.Min (frame.Right - borderThickness.Right, driver.Cols); c++) { @@ -850,7 +852,7 @@ namespace Terminal.Gui { } // Draw the left Padding - for (int r = Math.Max (frame.Y + sumThickness.Top, 0); + for (int r = frame.Y + sumThickness.Top; r < Math.Min (frame.Bottom - sumThickness.Bottom, driver.Rows); r++) { for (int c = frame.X + borderThickness.Left; c < Math.Min (frame.X + sumThickness.Left, frame.Right - borderThickness.Right); c++) { @@ -860,7 +862,7 @@ namespace Terminal.Gui { } // Draw the right Padding - for (int r = Math.Max (frame.Y + sumThickness.Top, 0); + for (int r = frame.Y + sumThickness.Top; r < Math.Min (frame.Bottom - sumThickness.Bottom, driver.Rows); r++) { for (int c = Math.Max (frame.Right - sumThickness.Right, frame.X + sumThickness.Left); c < Math.Max (frame.Right - borderThickness.Right, frame.X + sumThickness.Left); c++) {