From f820bf8d6ee3d330d1b250ecae6bfe14289f7603 Mon Sep 17 00:00:00 2001 From: Maarten ter Huurne Date: Mon, 12 Aug 2013 06:11:18 +0200 Subject: [PATCH] Scroll when link cursor moves into top/bottom row Previously, the links would scroll when the cursor was about to move out of screen. By scrolling earlier, the user gets a view of the next row before it becomes the current row. This allows a longer reaction time to switch from vertical to horizontal navigation when looking for a particular link in the grid. --- src/menu.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/menu.cpp b/src/menu.cpp index 655c711..8413eee 100644 --- a/src/menu.cpp +++ b/src/menu.cpp @@ -651,10 +651,11 @@ void Menu::setLinkIndex(int i) { iLink = i; int row = i / linkColumns; - if (row >= (int)(iFirstDispRow + linkRows)) - iFirstDispRow = row - linkRows + 1; - else if (row < (int)iFirstDispRow) - iFirstDispRow = row; + if (row >= (int)(iFirstDispRow + linkRows - 1)) + iFirstDispRow = min(row + 1, (int)DIV_ROUND_UP(numLinks, linkColumns) - 1) + - linkRows + 1; + else if (row <= (int)iFirstDispRow) + iFirstDispRow = max(row - 1, 0); } #ifdef HAVE_LIBOPK