OLED dont highlight entire row

This commit is contained in:
penfold42 2018-08-03 15:39:25 +10:00
parent 94040fa5c7
commit c55c5169dd

View file

@ -81,6 +81,10 @@ void FileBrowser::BrowsableListView::RefreshLine(u32 entryIndex, u32 x, u32 y, b
FileBrowser::BrowsableList::Entry* entry = &list->entries[entryIndex]; FileBrowser::BrowsableList::Entry* entry = &list->entries[entryIndex];
if (screen->IsMonocrome()) if (screen->IsMonocrome())
{ {
// pre-clear line on OLED
memset(buffer1, ' ', columnsMax);
screen->PrintText(false, x, y, buffer1, BkColour, BkColour);
if (entry->filImage.fattrib & AM_DIR) if (entry->filImage.fattrib & AM_DIR)
{ {
snprintf(buffer2, 256, "[%s]", entry->filImage.fname); snprintf(buffer2, 256, "[%s]", entry->filImage.fname);
@ -106,9 +110,14 @@ void FileBrowser::BrowsableListView::RefreshLine(u32 entryIndex, u32 x, u32 y, b
} }
int len = strlen(buffer2 + highlightScrollOffset); int len = strlen(buffer2 + highlightScrollOffset);
strncpy(buffer1, buffer2 + highlightScrollOffset, sizeof(buffer1)); strncpy(buffer1, buffer2 + highlightScrollOffset, sizeof(buffer1));
if (!screen->IsMonocrome())
{
// space pad the remainder of the line (but not on OLED==monochrome)
while (len < (int)columnsMax) while (len < (int)columnsMax)
buffer1[len++] = ' '; buffer1[len++] = ' ';
buffer1[columnsMax] = 0; buffer1[columnsMax] = 0;
}
if (selected) if (selected)
{ {
@ -140,7 +149,7 @@ void FileBrowser::BrowsableListView::RefreshLine(u32 entryIndex, u32 x, u32 y, b
} }
} }
} }
else else // line is blank, write spaces
{ {
memset(buffer1, ' ', columnsMax); memset(buffer1, ' ', columnsMax);
screen->PrintText(false, x, y, buffer1, BkColour, BkColour); screen->PrintText(false, x, y, buffer1, BkColour, BkColour);