diff options
-rwxr-xr-x | assets/plugins/strider.wasm | bin | 594197 -> 714280 bytes | |||
-rw-r--r-- | default-plugins/strider/src/main.rs | 2 | ||||
-rw-r--r-- | default-plugins/strider/src/state.rs | 12 |
3 files changed, 8 insertions, 6 deletions
diff --git a/assets/plugins/strider.wasm b/assets/plugins/strider.wasm Binary files differindex 3030e911a..d0de0ae14 100755 --- a/assets/plugins/strider.wasm +++ b/assets/plugins/strider.wasm diff --git a/default-plugins/strider/src/main.rs b/default-plugins/strider/src/main.rs index 75f03513d..4ce0b0434 100644 --- a/default-plugins/strider/src/main.rs +++ b/default-plugins/strider/src/main.rs @@ -27,7 +27,7 @@ impl ZellijPlugin for State { } Key::Down | Key::Char('j') => { let next = self.selected().saturating_add(1); - *self.selected_mut() = min(self.files.len() - 1, next); + *self.selected_mut() = min(self.files.len().saturating_sub(1), next); } Key::Right | Key::Char('\n') | Key::Char('l') if !self.files.is_empty() => { self.traverse_dir_or_open_file(); diff --git a/default-plugins/strider/src/state.rs b/default-plugins/strider/src/state.rs index 7c19cb695..81d44a61d 100644 --- a/default-plugins/strider/src/state.rs +++ b/default-plugins/strider/src/state.rs @@ -34,12 +34,14 @@ impl State { self.hide_hidden_files = !self.hide_hidden_files; } pub fn traverse_dir_or_open_file(&mut self) { - match self.files[self.selected()].clone() { - FsEntry::Dir(p, _) => { - self.path = p; - refresh_directory(self); + if let Some(f) = self.files.get(self.selected()) { + match f.clone() { + FsEntry::Dir(p, _) => { + self.path = p; + refresh_directory(self); + } + FsEntry::File(p, _) => open_file(p.strip_prefix(ROOT).unwrap()), } - FsEntry::File(p, _) => open_file(p.strip_prefix(ROOT).unwrap()), } } } |