summaryrefslogtreecommitdiffstats
path: root/src/actioner.rs
diff options
context:
space:
mode:
authorqkzk <qu3nt1n@gmail.com>2022-12-04 22:30:34 +0100
committerqkzk <qu3nt1n@gmail.com>2022-12-04 22:30:34 +0100
commitba8db1c67d84279f182b85437554f7151f260ded (patch)
tree3849e143999c79a7c9aa84725cca3ceb7d8087fe /src/actioner.rs
parent1e9dc42f2bb8ca6fffa82d385a8de20f1ee04eb9 (diff)
use macro to convert EventChar to string back and forth. Propagate casting errors.
Diffstat (limited to 'src/actioner.rs')
-rw-r--r--src/actioner.rs16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/actioner.rs b/src/actioner.rs
index 372f027..171a49f 100644
--- a/src/actioner.rs
+++ b/src/actioner.rs
@@ -4,6 +4,7 @@ use crate::fm_error::FmResult;
use crate::keybindings::Keybindings;
use crate::mode::{MarkAction, Mode};
use crate::status::Status;
+use crate::term_manager::MIN_WIDTH_FOR_DUAL_PANE;
/// Struct which mutates `tabs.selected()..
/// Holds a mapping which can't be static since it's read from a config file.
@@ -271,12 +272,7 @@ impl Actioner {
Mode::Goto | Mode::Exec | Mode::Search => {
status.selected().event_replace_input_with_completion()
}
- Mode::Normal => {
- if status.len_index_of_tabs().0 == 1 {
- status.new_tab()
- }
- status.next()
- }
+ Mode::Normal => status.next(),
_ => (),
};
Ok(())
@@ -362,7 +358,13 @@ impl Actioner {
}
}
- fn resize(&self, status: &mut Status, _: usize, height: usize) -> FmResult<()> {
+ fn resize(&self, status: &mut Status, width: usize, height: usize) -> FmResult<()> {
+ if width < MIN_WIDTH_FOR_DUAL_PANE {
+ status.select_tab(0)?;
+ status.set_dual_pane(false);
+ } else {
+ status.set_dual_pane(true);
+ }
status.selected().set_height(height);
self.refresh_selected_view(status)?;
Ok(())