summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorqkzk <qu3nt1n@gmail.com>2024-01-24 14:53:48 +0100
committerqkzk <qu3nt1n@gmail.com>2024-01-24 14:53:48 +0100
commit64e186cd24bc298dacf133720aad292642c7fa29 (patch)
treeca8c82c78c2076799377d20d89c896dc221ba02f
parent7bd712e42855826791ce692b07cf3ee200e2ceaa (diff)
WIP binds per mode
-rw-r--r--development.md9
-rw-r--r--src/io/display.rs11
-rw-r--r--src/modes/edit/help.rs16
-rw-r--r--src/modes/edit/mod.rs2
4 files changed, 36 insertions, 2 deletions
diff --git a/development.md b/development.md
index 354025e..f95ef05 100644
--- a/development.md
+++ b/development.md
@@ -891,7 +891,12 @@ New view: Tree ! Toggle with 't', fold with 'z'. Navigate normally.
- [x] FIX: leaving mount mode with enter when device is mounted should move to it
- [x] FIX: clicking footer row execute directory actions, even in flagged display mode
- [ ] FIX: leaving flagged file should reset the window correctly. Can't reproduce...
-- [ ] display all specific binds for every mode with a key ?
+- [ ] display all specific binds for every mode.
+
+ - [ ] specific help with default binds
+ - [ ] custom binds
+ - [ ] disable in config
+
- [ ] search, display nb of matches, completion + flag on the fly
- [x] use regex in search
@@ -910,6 +915,8 @@ New view: Tree ! Toggle with 't', fold with 'z'. Navigate normally.
- [x] remove MOCP control from fm
- [x] allow header & footer to be right aligned
- [x] merge both bulkthing modes. If more files, just create them. Like [oil](https://github.com/stevearc/oil.nvim)
+- [ ] allow different ports in remote
+- [ ] sort trash by reversed date
- [ ] ???
## TODO
diff --git a/src/io/display.rs b/src/io/display.rs
index f1a33c3..adf3f5a 100644
--- a/src/io/display.rs
+++ b/src/io/display.rs
@@ -712,6 +712,7 @@ impl<'a> Draw for WinSecondary<'a> {
}?;
self.draw_cursor(canvas)?;
self.draw_second_line(canvas)?;
+ self.draw_binds_per_mode(canvas, self.tab.edit_mode)?;
WinSecondaryFirstLine::new(self.status).draw(canvas)
}
@@ -751,6 +752,16 @@ impl<'a> WinSecondary<'a> {
Ok(())
}
+ fn draw_binds_per_mode(&self, canvas: &mut dyn Canvas, mode: Edit) -> Result<()> {
+ canvas.print_with_attr(
+ canvas.height()? - 1,
+ 2,
+ crate::modes::binds_per_mode(mode),
+ color_to_attr(MENU_COLORS.second),
+ )?;
+ Ok(())
+ }
+
/// Display the possible completion items. The currently selected one is
/// reversed.
fn draw_completion(&self, canvas: &mut dyn Canvas) -> Result<()> {
diff --git a/src/modes/edit/help.rs b/src/modes/edit/help.rs
index 7d2b649..2efc3ad 100644
--- a/src/modes/edit/help.rs
+++ b/src/modes/edit/help.rs
@@ -3,6 +3,7 @@ use strfmt::strfmt;
use crate::config::Bindings;
use crate::io::Opener;
+use crate::modes::{Edit, InputSimple, MarkAction, Navigate};
/// Help message to be displayed when help key is pressed.
/// Default help key is `'h'`.
@@ -111,6 +112,7 @@ Different modes for the bottom window
{RemoteMount:<10}: MOUNT REMOTE PATH
{Filter:<10}: FILTER
(by name \"n name\", by ext \"e ext\", \"d only directories\" or \"a all\" for reset)
+{Context:<10}: CONTEXT
{Enter:<10}: Execute mode then NORMAL
";
@@ -164,3 +166,17 @@ fn complete_with_custom_binds(custom_binds: &Option<Vec<String>>, mut help: Stri
}
help
}
+
+pub fn binds_per_mode(edit_mode: Edit) -> &'static str {
+ match edit_mode {
+ Edit::InputCompleted(_) => "Tab to complete. shift+up, shift+down to cycle trough previous entries, shift+left to erase line. Enter to validate",
+ Edit::InputSimple(InputSimple::Filter) => "Enter reset the filters",
+ Edit::InputSimple(InputSimple::Sort ) => "Enter reset the sort",
+ Edit::InputSimple(_) => "shift+up, shift+down to cycle trough previous entries, shift+left to erase line. Enter to validate",
+ Edit::Navigate(Navigate::Marks(MarkAction::Jump)) => "Type the mark letter to jump there. up, down to navigate, ENTER to select an element",
+ Edit::Navigate(Navigate::Marks(MarkAction::New)) => "Type the mark set a mark here. up, down to navigate, ENTER to select an element",
+ Edit::Navigate(_) => "up, down to navigate, ENTER to select an element",
+ Edit::NeedConfirmation(_) => "",
+ _ => "",
+ }
+}
diff --git a/src/modes/edit/mod.rs b/src/modes/edit/mod.rs
index 6906bc2..f784ca8 100644
--- a/src/modes/edit/mod.rs
+++ b/src/modes/edit/mod.rs
@@ -45,7 +45,7 @@ pub use decompress::{decompress_gz, decompress_xz, decompress_zip};
pub use decompress::{list_files_tar, list_files_zip};
pub use filter::FilterKind;
pub use flagged::Flagged;
-pub use help::help_string;
+pub use help::{binds_per_mode, help_string};
pub use history::History;
pub use input::Input;
pub use iso::IsoDevice;