mirror of
https://github.com/Rockbox/rockbox.git
synced 2026-07-10 13:29:52 -04:00
[Bugfix] lua splash_scroller line formatting
I accidentally added an extra character wittthe last patch by changing < to <= in the process of testing this I realized spaces were sometimes being included at the beginning of the line and also that sometime sentences were being cut short even though they fit on the screen Change-Id: Iee0ed64e18defad2acb3c107d334ea2a49bd5b6f
This commit is contained in:
parent
c0027abd0e
commit
7a32c8b5e3
1 changed files with 9 additions and 6 deletions
|
|
@ -77,7 +77,7 @@ int splash_scroller(int timeout, const char* str)
|
|||
const int max_lines = LCD_HEIGHT / ch_h - 1;
|
||||
const int wrap_thresh = (LCD_WIDTH / 4);
|
||||
|
||||
const int max_ch = (LCD_WIDTH / ch_w - 1) * 2;
|
||||
const int max_ch = (LCD_WIDTH / ch_w - 1) * 3;
|
||||
char line[max_ch + 2]; /* display buffer +2 incase of tab chars */
|
||||
const char break_chars[] = "/\\ \r\n\f\v";
|
||||
const char *ch, *brk;
|
||||
|
|
@ -99,8 +99,10 @@ int splash_scroller(int timeout, const char* str)
|
|||
{
|
||||
linepos = 0;
|
||||
brk = NULL;
|
||||
|
||||
maxl = rb->font_measurestring(ch, max_ch, max_w, &w, NULL, fontnum);
|
||||
for (; *ch && linepos <= maxl; ch++)
|
||||
|
||||
for (; *ch && linepos < maxl; ch++)
|
||||
{
|
||||
if (strpbrk_n(ch, 1, break_chars))
|
||||
{
|
||||
|
|
@ -134,9 +136,9 @@ int splash_scroller(int timeout, const char* str)
|
|||
continue;
|
||||
}
|
||||
else
|
||||
line[linepos] = ch[0];
|
||||
|
||||
linepos++;
|
||||
{
|
||||
line[linepos++] = ch[0];
|
||||
}
|
||||
}
|
||||
line[linepos] = '\0';
|
||||
|
||||
|
|
@ -157,7 +159,8 @@ int splash_scroller(int timeout, const char* str)
|
|||
linesdisp++;
|
||||
last_break = 0;
|
||||
}
|
||||
|
||||
if (linepos == maxl && isspace(*ch)) /* we would have split at this space if we could see it */
|
||||
ch++;
|
||||
curline++;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue