aboutsummaryrefslogtreecommitdiffstats
path: root/default-plugins/strider/src
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2022-11-15 12:21:36 +0100
committerGitHub <noreply@github.com>2022-11-15 12:21:36 +0100
commit3d2a6d6a5aa47cace356fe39184f2ac018898552 (patch)
tree3f57d6b63bd5943224139bfc65bb4ff562bf0f91 /default-plugins/strider/src
parentdocs(changelog): update log path (diff)
downloadsl0ppij-3d2a6d6a5aa47cace356fe39184f2ac018898552.tar.gz
sl0ppij-3d2a6d6a5aa47cace356fe39184f2ac018898552.tar.xz
sl0ppij-3d2a6d6a5aa47cace356fe39184f2ac018898552.zip
refactor(plugins): change the data flow (#1934)
* refactor(plugins): do not block render loop * refactor(plugins): cleanup * style(fmt): rustfmt * fix(plugins): various rendering pipeline fixes
Diffstat (limited to 'default-plugins/strider/src')
-rw-r--r--default-plugins/strider/src/main.rs15
1 files changed, 12 insertions, 3 deletions
diff --git a/default-plugins/strider/src/main.rs b/default-plugins/strider/src/main.rs
index 22ca1c61..fcac6ec6 100644
--- a/default-plugins/strider/src/main.rs
+++ b/default-plugins/strider/src/main.rs
@@ -93,6 +93,7 @@ impl ZellijPlugin for State {
*self.scroll_mut() = self.selected() + 2 - rows;
}
+ let is_last_row = i == rows.saturating_sub(1);
let i = self.scroll() + i;
if let Some(entry) = self.files.get(i) {
let mut path = entry.as_line(cols).normal();
@@ -102,11 +103,19 @@ impl ZellijPlugin for State {
}
if i == self.selected() {
- println!("{}", path.reversed());
+ if is_last_row {
+ print!("{}", path.reversed());
+ } else {
+ println!("{}", path.reversed());
+ }
} else {
- println!("{}", path);
+ if is_last_row {
+ print!("{}", path);
+ } else {
+ println!("{}", path);
+ }
}
- } else {
+ } else if !is_last_row {
println!();
}
}