Don't scroll one character past the filename end

This commit is contained in:
Yuri D'Elia 2021-02-03 15:49:22 +01:00 committed by Alex Voinea
parent 8445f76eb9
commit 640e8d899b
1 changed files with 6 additions and 8 deletions

View File

@ -7105,17 +7105,15 @@ void lcd_sdcard_menu()
if (_md->isDir) lcd_print(LCD_STR_FOLDER[0]);
for (; i != 0; i--)
{
char c = *(_md->scrollPointer + _md->offset +((LCD_WIDTH - ((_md->isDir)?2:1)) - i));
if (c == '\0')
{
const char* c = (_md->scrollPointer + _md->offset + ((LCD_WIDTH - ((_md->isDir)?2:1)) - i));
lcd_print(c[0]);
if (c[1])
_md->lcd_scrollTimer.start();
else
{
_md->lcd_scrollTimer.stop();
break; //stop at the end of the string
}
else
{
lcd_print(c);
_md->lcd_scrollTimer.start();
}
}
if (i != 0) //adds spaces if string is incomplete or at the end (instead of null).
{