diff options
author | DLFW <daniel@llin.info> | 2021-06-20 01:14:10 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-19 19:14:10 -0400 |
commit | e6359a599e804031189eb9bc067c4eff9b01a1a8 (patch) | |
tree | f94102b28145f91db5b0bded5e38869157c1946f /src/ui/widgets/tui_footer.rs | |
parent | 362a507ad60ee479fb68a48fc7daf4a49652f1bf (diff) |
Show symlinked files and dirs correctly (#72)
* Treat symlinks as normal files and dirs
* Dirs are recognized as dirs no matter is they are a symlink
(correct devicon)
* Permission flags shown in the footer are the permissions of the target
in case a symlink is selected
* Size of a symlinked file is the size of the target
* File display to be fixed: symlink arrow now just overrides the file
size, but both need to be shown one after the other
* Correctly show symlink arrow and file size next
This commit includes quite some refactoring. The shortening of the
left and right part of an entry in a dir list and the shortening of the
file name are separated into functions which don't directly write to the
buffer but just return strings. That way, they get testable and further
enhancements like different line modes should be easier to implement.
* fix review findings
* better file name truncation
File names are only truncated at grapheme border, while the width is
calculated on the actual nuber of terminal cells.
* more adequate test organization
* more code structure
Diffstat (limited to 'src/ui/widgets/tui_footer.rs')
-rw-r--r-- | src/ui/widgets/tui_footer.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/ui/widgets/tui_footer.rs b/src/ui/widgets/tui_footer.rs index 7c7cbda..1bf9c2a 100644 --- a/src/ui/widgets/tui_footer.rs +++ b/src/ui/widgets/tui_footer.rs @@ -4,7 +4,7 @@ use tui::style::{Color, Style}; use tui::text::{Span, Spans}; use tui::widgets::{Paragraph, Widget}; -use crate::fs::{FileType, JoshutoDirList}; +use crate::fs::{JoshutoDirList, LinkType}; use crate::util::format; use crate::util::unix; @@ -41,7 +41,7 @@ impl<'a> Widget for TuiFooter<'a> { Span::raw(size_str), ]; - if let FileType::Symlink(s) = entry.metadata.file_type() { + if let LinkType::Symlink(s) = entry.metadata.link_type() { text.push(Span::styled(" -> ", mode_style)); text.push(Span::styled(s, mode_style)); } |