From 6f36965b083f30a327e23242e391d00e522d1831 Mon Sep 17 00:00:00 2001 From: BDisp Date: Thu, 2 Jul 2020 15:57:50 +0100 Subject: [PATCH 1/2] Added a condition when both scroll bars depends on each other. --- Terminal.Gui/Views/ScrollView.cs | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/Terminal.Gui/Views/ScrollView.cs b/Terminal.Gui/Views/ScrollView.cs index 74b90f9fa..952375f3a 100644 --- a/Terminal.Gui/Views/ScrollView.cs +++ b/Terminal.Gui/Views/ScrollView.cs @@ -152,13 +152,19 @@ namespace Terminal.Gui { var by2 = (position + bh) * bh / Size; Move (col, 0); - Driver.AddRune (Driver.UpArrow); + if (Bounds.Height == 1) { + Driver.AddRune (Driver.Diamond); + } else { + Driver.AddRune (Driver.UpArrow); + } if (Bounds.Height == 3) { Move (col, 1); Driver.AddRune (Driver.Diamond); } - Move (col, Bounds.Height - 1); - Driver.AddRune (Driver.DownArrow); + if (Bounds.Height > 1) { + Move (col, Bounds.Height - 1); + Driver.AddRune (Driver.DownArrow); + } } else { bh -= 2; var by1 = position * bh / Size; @@ -533,13 +539,15 @@ namespace Terminal.Gui { void ShowHideScrollBars () { - bool v = false, h = false; + bool v = false, h = false; bool p = false; if (Bounds.Height == 0 || Bounds.Height > contentSize.Height) { if (ShowVerticalScrollIndicator) { ShowVerticalScrollIndicator = false; } v = false; + } else if (Bounds.Height > 0 && Bounds.Height == contentSize.Height) { + p = true; } else { if (!ShowVerticalScrollIndicator) { ShowVerticalScrollIndicator = true; @@ -551,7 +559,22 @@ namespace Terminal.Gui { ShowHorizontalScrollIndicator = false; } h = false; + } else if (Bounds.Width > 0 && Bounds.Width == contentSize.Width && p) { + if (ShowHorizontalScrollIndicator) { + ShowHorizontalScrollIndicator = false; + } + h = false; + if (!ShowVerticalScrollIndicator) { + ShowVerticalScrollIndicator = true; + } + v = true; } else { + if (p) { + if (!ShowVerticalScrollIndicator) { + ShowVerticalScrollIndicator = true; + } + v = true; + } if (!ShowHorizontalScrollIndicator) { ShowHorizontalScrollIndicator = true; } From fe1ef4c07fb4b9c46266462a54e82ae82c828e0c Mon Sep 17 00:00:00 2001 From: BDisp Date: Thu, 2 Jul 2020 16:09:00 +0100 Subject: [PATCH 2/2] Fixe a bug. --- Terminal.Gui/Views/ScrollView.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Terminal.Gui/Views/ScrollView.cs b/Terminal.Gui/Views/ScrollView.cs index 952375f3a..795ed7c5c 100644 --- a/Terminal.Gui/Views/ScrollView.cs +++ b/Terminal.Gui/Views/ScrollView.cs @@ -564,10 +564,10 @@ namespace Terminal.Gui { ShowHorizontalScrollIndicator = false; } h = false; - if (!ShowVerticalScrollIndicator) { - ShowVerticalScrollIndicator = true; + if (ShowVerticalScrollIndicator) { + ShowVerticalScrollIndicator = false; } - v = true; + v = false; } else { if (p) { if (!ShowVerticalScrollIndicator) {