diff options
| author | mo8it <mo8it@proton.me> | 2024-08-25 23:53:50 +0200 |
|---|---|---|
| committer | mo8it <mo8it@proton.me> | 2024-08-25 23:53:50 +0200 |
| commit | b1898f6d8b2c2ae45279ca4c67fa1b1a94acb936 (patch) | |
| tree | 25022e8fc2bc6254fc819d98ea278f04dd5d6bab /src/terminal_link.rs | |
| parent | d29e9e7e07a16adda35aea9ce9dd120b6ecc9dfc (diff) | |
Use queue instead of Stylize
Diffstat (limited to 'src/terminal_link.rs')
| -rw-r--r-- | src/terminal_link.rs | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/src/terminal_link.rs b/src/terminal_link.rs deleted file mode 100644 index 9bea07d..0000000 --- a/src/terminal_link.rs +++ /dev/null @@ -1,26 +0,0 @@ -use std::{ - fmt::{self, Display, Formatter}, - fs, -}; - -pub struct TerminalFileLink<'a>(pub &'a str); - -impl<'a> Display for TerminalFileLink<'a> { - fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { - let path = fs::canonicalize(self.0); - - if let Some(path) = path.as_deref().ok().and_then(|path| path.to_str()) { - // Windows itself can't handle its verbatim paths. - #[cfg(windows)] - let path = if path.len() > 5 && &path[0..4] == r"\\?\" { - &path[4..] - } else { - path - }; - - write!(f, "\x1b]8;;file://{path}\x1b\\{}\x1b]8;;\x1b\\", self.0) - } else { - write!(f, "{}", self.0) - } - } -} |
