Skip to content

Commit

Permalink
Saner mouse support
Browse files Browse the repository at this point in the history
  • Loading branch information
keithbowes committed Jun 9, 2016
1 parent 6f388c4 commit 1808f4a
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/ui/tui/tui.pas
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 1808f4a

Please sign in to comment.