fix: always show the size in the status bar even in empty directories (#2449)

This commit is contained in:
三咲雅 · Misaki Masa 2025-03-06 18:54:13 +08:00 committed by GitHub
parent 3dc6d82b98
commit dc46e90b0a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 5 deletions

View file

@ -24,7 +24,7 @@ Yazi (means "duck") is a terminal file manager written in Rust, based on non-blo
- 🌟 **Built-in Code Highlighting and Image Decoding**: Combined with the pre-loading mechanism, greatly accelerates image and normal file loading.
- 🔌 **Concurrent Plugin System**: UI plugins (rewriting most of the UI), functional plugins, custom previewer/preloader/spotter/fetcher; Just some pieces of Lua.
- 📡 **Data Distribution Service**: Built on a client-server architecture (no additional server process required), integrated with a Lua-based publish-subscribe model, achieving cross-instance communication and state persistence.
- 📦 **Package Manager**: Install plugins and themes with one command, keeping them up to date, or pin them to a specific version.
- 📦 **Package Manager**: Install plugins and themes with one command, keeping them up-to-date, or pin them to a specific version.
- 🧰 Integration with ripgrep, fd, fzf, zoxide
- 💫 Vim-like input/pick/confirm/which/notify component, auto-completion for cd paths
- 🏷️ Multi-Tab Support, Cross-directory selection, Scrollable Preview (for videos, PDFs, archives, code, directories, etc.)

View file

@ -48,13 +48,11 @@ end
function Status:size()
local h = self._current.hovered
if not h then
return ""
end
local size = h and (h:size() or h.cha.len) or 0
local style = self:style()
return ui.Line {
ui.Span(" " .. ya.readable_size(h:size() or h.cha.len) .. " "):style(style.alt),
ui.Span(" " .. ya.readable_size(size) .. " "):style(style.alt),
ui.Span(th.status.sep_left.close):fg(style.alt.bg),
}
end