diff options
-rw-r--r-- | Cargo.lock | 2 | ||||
-rw-r--r-- | Cargo.toml | 2 | ||||
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | src/app/app.rs | 6 | ||||
-rw-r--r-- | src/app/state.rs | 12 | ||||
-rw-r--r-- | src/browser/browser_state.rs | 8 | ||||
-rw-r--r-- | src/errors.rs | 1 | ||||
-rw-r--r-- | src/verb/internal.rs | 2 |
8 files changed, 18 insertions, 17 deletions
@@ -274,6 +274,8 @@ dependencies = [ [[package]] name = "cli-clipboard" version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c806d0d69ff99a6802438a2f2fb39af1bc3d3e0e72f100c3ee91cd7c63822e93" dependencies = [ "anyhow", "clipboard-win", @@ -21,7 +21,7 @@ client-server = [] ansi_colours = "1.0" bet = "0.3.4" clap = { version="2.33", default-features=false, features=["suggestions"] } -cli-clipboard = {path="/home/zx/workspace/git/cli-clipboard"} +cli-clipboard = "0.2" chrono = "0.4" crossbeam = "0.7" crossterm = "0.17.7" @@ -18,6 +18,8 @@ A better way to navigate directories [Install Broot](https://dystroy.org/broot/install/) + + # Get an overview of a directory, even a big one `br -s` diff --git a/src/app/app.rs b/src/app/app.rs index 14dcb39..11f2e17 100644 --- a/src/app/app.rs +++ b/src/app/app.rs @@ -266,7 +266,11 @@ impl App { self.mut_panel().refresh_input_status(&other_path, con); } } - Keep => {} + Keep => { + if is_input_invocation { + self.mut_panel().clear_input_invocation(); + } + } Launch(launchable) => { self.launch_at_end = Some(*launchable); self.quitting = true; diff --git a/src/app/state.rs b/src/app/state.rs index d1baf52..81782f4 100644 --- a/src/app/state.rs +++ b/src/app/state.rs @@ -82,11 +82,13 @@ pub trait AppState { Ok(match internal_exec.internal { Internal::back => AppStateCmdResult::PopState, Internal::copy_path => { - cli_clipboard::set_contents( self.selected_path().to_string_lossy().into_owned() ) - .map_err( |_| ProgramError::ClipboardError )? - ; - - AppStateCmdResult::Keep + let path = self.selected_path().to_string_lossy().to_string(); + match cli_clipboard::set_contents(path) { + Ok(()) => AppStateCmdResult::Keep, + Err(_) => AppStateCmdResult::DisplayError( + "Clipboard error while copying path".to_string() + ), + } } Internal::close_panel_ok => AppStateCmdResult::ClosePanel { validate_purpose: true, diff --git a/src/browser/browser_state.rs b/src/browser/browser_state.rs index 3562fe5..9cd833b 100644 --- a/src/browser/browser_state.rs +++ b/src/browser/browser_state.rs @@ -331,14 +331,6 @@ impl AppState for BrowserState { AppStateCmdResult::PopState } } - Internal::copy_path => { - let path = &self.displayed_tree().selected_line().target(); - cli_clipboard::set_contents( path.to_string_lossy().into_owned() ) - .map_err( |_| ProgramError::ClipboardError )? - ; - - AppStateCmdResult::Keep - } Internal::focus => internal_focus::on_internal( internal_exec, input_invocation, diff --git a/src/errors.rs b/src/errors.rs index c61a475..751548d 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -11,7 +11,6 @@ custom_error! {pub ProgramError Io {source: io::Error} = "IO Error : {:?}", Crossterm {source: crossterm::ErrorKind} = "Crossterm Error : {:?}", Termimad {source: termimad::Error} = "Termimad Error : {:?}", - ClipboardError = "Clipboard handler error: unable to copy to clipboard", Conf {source: ConfError} = "Bad configuration: {}", ArgParse {bad: String, valid: String} = "{:?} can't be parsed (valid values: {:?})", UnknownVerb {name: String} = "No verb matches {:?}", diff --git a/src/verb/internal.rs b/src/verb/internal.rs index 68b86bf..d19240d 100644 --- a/src/verb/internal.rs +++ b/src/verb/internal.rs @@ -56,7 +56,7 @@ Internals! { back: "revert to the previous state (mapped to *esc*)", close_panel_ok: "close the panel, validating the selected path", close_panel_cancel: "close the panel, not using the selected path", - copy_path: "copy path to system clipboard (mapped to *alt-c*)", + copy_path: "copy path to system clipboard", focus: "display the directory (mapped to *enter*)", help: "display broot's help", input_del_char_left: "delete the char left of the cursor", |