From 1808f4a249f8f2f465ea3bfc63f6f4e454248cbc Mon Sep 17 00:00:00 2001 From: Keith Bowes Date: Thu, 9 Jun 2016 14:43:07 -0400 Subject: [PATCH] Saner mouse support --- src/ui/tui/tui.pas | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/ui/tui/tui.pas b/src/ui/tui/tui.pas index 6135cb6..f115cf6 100644 --- a/src/ui/tui/tui.pas +++ b/src/ui/tui/tui.pas @@ -292,17 +292,19 @@ constructor TTui.Create; end else if mouse_event.bstate and BUTTON_SCROLL_DOWN = BUTTON_SCROLL_DOWN then begin - FCurrentItem := FViewPort.FirstItem + FViewPort.PortHeight; - if FItems^.Count - 1 > FCurrentItem then + if FItems^.Count > FCurrentItem then begin Inc(FCurrentItem); + ScrollTo(FCurrentItem); end; - ScrollTo(FCurrentItem); end else if mouse_event.bstate and BUTTON_SCROLL_UP = BUTTON_SCROLL_UP then begin - ScrollUp; - Redraw; + if FCurrentItem > 1 then + begin + Dec(FCurrentItem); + ScrollTo(FCurrentItem); + end end end; end;