style: beautify file browser display

- Removed trailing slashes from directory names
- Added '>' prefix to directories
- Indented file names for better visual alignment
This commit is contained in:
ratedcounsel 2025-12-31 14:17:22 +00:00
parent 768f2bd815
commit 96c0137648

View File

@ -220,7 +220,16 @@ void FileSelectionActivity::render() const {
const auto pageStartIndex = selectorIndex / PAGE_ITEMS * PAGE_ITEMS; const auto pageStartIndex = selectorIndex / PAGE_ITEMS * PAGE_ITEMS;
renderer.fillRect(0, listStartY + (selectorIndex % PAGE_ITEMS) * rowHeight - 2, pageWidth - 1, rowHeight); renderer.fillRect(0, listStartY + (selectorIndex % PAGE_ITEMS) * rowHeight - 2, pageWidth - 1, rowHeight);
for (int i = pageStartIndex; i < files.size() && i < pageStartIndex + PAGE_ITEMS; i++) { for (int i = pageStartIndex; i < files.size() && i < pageStartIndex + PAGE_ITEMS; i++) {
auto item = renderer.truncatedText(UI_10_FONT_ID, files[i].c_str(), pageWidth - horizontalMargin * 2 - 8); const auto& filename = files[i];
const bool isDir = !filename.empty() && filename.back() == '/';
// Format: folders show as "> FolderName", files show as " FileName"
std::string displayName;
if (isDir) {
displayName = "> " + filename.substr(0, filename.length() - 1);
} else {
displayName = " " + filename;
}
auto item = renderer.truncatedText(UI_10_FONT_ID, displayName.c_str(), pageWidth - horizontalMargin * 2 - 8);
renderer.drawText(UI_10_FONT_ID, horizontalMargin + 4, listStartY + (i % PAGE_ITEMS) * rowHeight, item.c_str(), renderer.drawText(UI_10_FONT_ID, horizontalMargin + 4, listStartY + (i % PAGE_ITEMS) * rowHeight, item.c_str(),
i != selectorIndex); i != selectorIndex);
} }