summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/menu.cc
diff options
context:
space:
mode:
authorJames Ravn <james.ravn@gmail.com>2013-07-03 16:22:03 -0500
committerNeil Moore <neil@s-z.org>2013-07-04 07:03:35 -0400
commit280b7835a7bc0c21b61ce711077aaaf040d7bdc9 (patch)
tree5b7b3b699346d0e3bd6b8ab7ab483585cc1026d5 /crawl-ref/source/menu.cc
parent8b27fd8d3bc9619ee8e80e1fcb7a17933a5e9466 (diff)
downloadcrawl-ref-280b7835a7bc0c21b61ce711077aaaf040d7bdc9.tar.gz
crawl-ref-280b7835a7bc0c21b61ce711077aaaf040d7bdc9.zip
Fixes help menu scrolling when at the first line
The menu code was jumping to the previous entry instead of the actual hotkey'd entry. This could be a MEL_TITLE which leads to some broken behavior in the help menu. The most noticeable is in webtiles, where you couldn't use the down arrow to scroll when at the top of a help menu. In console a blank line showed up at the top of the help page, but you couldn't scroll back to it. This patch fixes it by jumping to the correct entry (the entry after the MEL_TITLE).
Diffstat (limited to 'crawl-ref/source/menu.cc')
-rw-r--r--crawl-ref/source/menu.cc9
1 files changed, 3 insertions, 6 deletions
diff --git a/crawl-ref/source/menu.cc b/crawl-ref/source/menu.cc
index 76e8974efb..5cdc798cfb 100644
--- a/crawl-ref/source/menu.cc
+++ b/crawl-ref/source/menu.cc
@@ -1638,7 +1638,7 @@ void Menu::webtiles_update_section_boundaries()
{
_webtiles_section_start = first_entry;
while (_webtiles_section_start > 0
- && items[_webtiles_section_start]->level != MEL_TITLE)
+ && items[_webtiles_section_start - 1]->level != MEL_TITLE)
{
_webtiles_section_start--;
}
@@ -1897,13 +1897,10 @@ string get_linebreak_string(const string& s, int maxcol)
bool formatted_scroller::jump_to(int i)
{
- if (i == first_entry + 1)
+ if (i == first_entry)
return false;
- if (i == 0)
- first_entry = 0;
- else
- first_entry = i - 1;
+ first_entry = i;
#ifdef USE_TILE_WEB
webtiles_update_section_boundaries();