From a686684186e2a4c30fe7e1ed30c585c469340a43 Mon Sep 17 00:00:00 2001 From: BDisp Date: Thu, 11 Apr 2024 17:01:20 +0100 Subject: [PATCH 1/3] Allow mouse horizontal scrolling. --- Terminal.Gui/Core/Event.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Terminal.Gui/Core/Event.cs b/Terminal.Gui/Core/Event.cs index a46bbf7e5..af22472df 100644 --- a/Terminal.Gui/Core/Event.cs +++ b/Terminal.Gui/Core/Event.cs @@ -753,13 +753,13 @@ namespace Terminal.Gui { /// WheeledDown = unchecked((int)0x20000000), /// - /// Vertical button wheeled up while pressing ButtonShift. + /// Vertical button wheeled up while pressing ButtonCtrl. /// - WheeledLeft = ButtonShift | WheeledUp, + WheeledLeft = ButtonCtrl | WheeledUp, /// - /// Vertical button wheeled down while pressing ButtonShift. + /// Vertical button wheeled down while pressing ButtonCtrl. /// - WheeledRight = ButtonShift | WheeledDown, + WheeledRight = ButtonCtrl | WheeledDown, /// /// Mask that captures all the events. /// From ba3af075f773266cc17be32a2ba30328e3fc2af1 Mon Sep 17 00:00:00 2001 From: BDisp Date: Thu, 11 Apr 2024 17:28:48 +0100 Subject: [PATCH 2/3] Fix horizontal scrolling in the ListView. --- Terminal.Gui/Views/ListView.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Terminal.Gui/Views/ListView.cs b/Terminal.Gui/Views/ListView.cs index 3ccdc0395..e0d4edbda 100644 --- a/Terminal.Gui/Views/ListView.cs +++ b/Terminal.Gui/Views/ListView.cs @@ -864,7 +864,8 @@ namespace Terminal.Gui { void RenderUstr (ConsoleDriver driver, ustring ustr, int col, int line, int width, int start = 0) { - var u = TextFormatter.ClipAndJustify (ustr, width + start, TextAlignment.Left); + ustring str = start > ustr.ConsoleWidth ? string.Empty : ustr.Substring (Math.Min (start, ustr.ToRunes ().Length - 1)); + ustring u = TextFormatter.ClipAndJustify (str, width, TextAlignment.Left); driver.AddStr (u); width -= TextFormatter.GetTextWidth (u); while (width-- + start > 0) { @@ -876,7 +877,7 @@ namespace Terminal.Gui { public void Render (ListView container, ConsoleDriver driver, bool marked, int item, int col, int line, int width, int start = 0) { var savedClip = container.ClipToBounds (); - container.Move (col - start, line); + container.Move (Math.Max (col - start, 0), line); var t = src? [item]; if (t == null) { RenderUstr (driver, ustring.Make (""), col, line, width); From 108afa97b893573d070ee4392c1081f0cbeb8628 Mon Sep 17 00:00:00 2001 From: BDisp Date: Thu, 11 Apr 2024 17:30:55 +0100 Subject: [PATCH 3/3] Fix size in the scenario. --- UICatalog/Scenarios/ListViewWithSelection.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/UICatalog/Scenarios/ListViewWithSelection.cs b/UICatalog/Scenarios/ListViewWithSelection.cs index c132cf8f5..2b668b3ea 100644 --- a/UICatalog/Scenarios/ListViewWithSelection.cs +++ b/UICatalog/Scenarios/ListViewWithSelection.cs @@ -79,9 +79,9 @@ namespace UICatalog.Scenarios { }; _listView.DrawContent += (e) => { - _scrollBar.Size = _listView.Source.Count - 1; + _scrollBar.Size = _listView.Source.Count; _scrollBar.Position = _listView.TopItem; - _scrollBar.OtherScrollBarView.Size = _listView.Maxlength - 1; + _scrollBar.OtherScrollBarView.Size = _listView.Maxlength; _scrollBar.OtherScrollBarView.Position = _listView.LeftItem; _scrollBar.Refresh (); };