From 03dac3e238871c08e011666ebb3eed54afa6b6fc Mon Sep 17 00:00:00 2001 From: Tig Date: Sat, 7 Sep 2024 10:29:56 -0600 Subject: [PATCH] Merged bdisp latest. Updated CharMap. --- Terminal.Gui/View/ViewportSettings.cs | 21 ++++++++++++++++++++- UICatalog/Scenarios/CharacterMap.cs | 12 ++++++------ 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/Terminal.Gui/View/ViewportSettings.cs b/Terminal.Gui/View/ViewportSettings.cs index f0e2af75e..711c87605 100644 --- a/Terminal.Gui/View/ViewportSettings.cs +++ b/Terminal.Gui/View/ViewportSettings.cs @@ -111,5 +111,24 @@ public enum ViewportSettings /// must be set for this setting to work (clipping beyond the visible area must be /// disabled). /// - ClearContentOnly = 32 + ClearContentOnly = 32, + + /// + /// If set, the vertical scroll bar (see ) will be enabled and automatically made visible + /// when the dimension of the is smaller than the dimension of . + /// + EnableHorizontalScrollBar = 64, + + /// + /// If set, the vertical scroll bar (see ) will be enabled and automatically made visible + /// when the dimension of the is smaller than the dimension of . + /// + EnableVerticalScrollBar = 128, + + /// + /// If set, the horizontal and vertical scroll bars (see cref="View.HorizontalScrollBar"/> and ) + /// will be enabled and automatically made visible when the dimension of the is smaller than the + /// dimension of . + /// + EnableScrollBars = EnableHorizontalScrollBar | EnableVerticalScrollBar } \ No newline at end of file diff --git a/UICatalog/Scenarios/CharacterMap.cs b/UICatalog/Scenarios/CharacterMap.cs index 7ce753095..c88d9f777 100644 --- a/UICatalog/Scenarios/CharacterMap.cs +++ b/UICatalog/Scenarios/CharacterMap.cs @@ -464,10 +464,10 @@ internal class CharMap : View ScrollBar hScrollBar = new () { - X = 0, + X = RowLabelWidth + 1, Y = Pos.AnchorEnd (), Width = Dim.Fill (1), - Size = GetContentSize ().Width, + Size = COLUMN_WIDTH * 15, Orientation = Orientation.Horizontal }; @@ -476,10 +476,10 @@ internal class CharMap : View ScrollBar vScrollBar = new () { X = Pos.AnchorEnd (), - Y = 0, + Y = 1, // Header Height = Dim.Fill (Dim.Func (() => hScrollBar.Visible ? 1 : 0)), Orientation = Orientation.Vertical, - Size = GetContentSize ().Height + Size = GetContentSize ().Height - _rowHeight, // Minus one row so last row stays visible }; vScrollBar.PositionChanged += (sender, args) => { Viewport = Viewport with { Y = args.CurrentValue }; }; @@ -488,7 +488,7 @@ internal class CharMap : View ViewportChanged += (sender, args) => { - vScrollBar.Size = GetContentSize ().Height; + vScrollBar.Size = GetContentSize ().Height - _rowHeight; // Minus one row so last row stays visible vScrollBar.Position = Viewport.Y; }; } @@ -970,7 +970,7 @@ internal class CharMap : View document.RootElement, new JsonSerializerOptions - { WriteIndented = true } + { WriteIndented = true } ); }