From 24287f46944159fd6ea121877aaa001e0f92e452 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Mon, 4 Feb 2019 09:10:18 +0100 Subject: [PATCH] fixed bug with cutting text on setup screens without scrollbar When drawing selection lists on setup sub-screens, text was always cut on the right side to prevent drawing text over a potential scrollbar, even if the selection list is short enough that there is no scrollbar. Now it is checked if the setup sub-screens has a scrollbar or not, and the right edge where text has to be cut is calculated accordingly. --- src/screens.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/screens.c b/src/screens.c index c8324210..64677bd2 100644 --- a/src/screens.c +++ b/src/screens.c @@ -4036,6 +4036,10 @@ static void DrawChooseTree(TreeInfo **ti_ptr) static void drawChooseTreeList(int first_entry, int num_page_entries, TreeInfo *ti) { + int num_entries = numTreeInfoInGroup(ti); + boolean scrollbar_needed = (num_entries > NUM_MENU_ENTRIES_ON_SCREEN); + int scrollbar_xpos = SC_SCROLLBAR_XPOS + menu.scrollbar_xoffset; + int screen_width = (scrollbar_needed ? scrollbar_xpos : SXSIZE); int i; char *title_string = NULL; int yoffset_sets = MENU_TITLE1_YPOS; @@ -4060,8 +4064,8 @@ static void drawChooseTreeList(int first_entry, int num_page_entries, int font_nr = FONT_TEXT_1; int font_xoffset = getFontBitmapInfo(font_nr)->draw_xoffset; int startx_text = startx + font_xoffset; - int startx_scrollbar = mSX + SC_SCROLLBAR_XPOS + menu.scrollbar_xoffset; - int text_size = startx_scrollbar - startx_text; + int endx_text = mSX + screen_width; + int text_size = endx_text - startx_text; int max_buffer_len = text_size / getFontWidth(font_nr); char buffer[max_buffer_len + 1]; -- 2.34.1