summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCanop <cano.petrole@gmail.com>2020-07-02 13:13:16 +0200
committerCanop <cano.petrole@gmail.com>2020-07-02 13:13:16 +0200
commitb013aef94ae0cf5ca78cc135b800b3824b00102c (patch)
tree880d5bb8b3a5c1325d1b1de38dd9e48a36746933
parentda3f4340a8ac5380884b6b6304ee3f1976434878 (diff)
add the `--git-status` launch option
-rw-r--r--CHANGELOG.md3
-rw-r--r--src/app/app.rs6
-rw-r--r--src/browser/browser_state.rs11
-rw-r--r--src/clap.rs5
-rw-r--r--src/conf/default_conf.rs2
-rw-r--r--src/display/displayable_tree.rs2
-rw-r--r--src/tree/tree.rs1
-rw-r--r--src/tree/tree_options.rs4
-rw-r--r--website/docs/install.md2
-rw-r--r--website/docs/skins.md7
10 files changed, 36 insertions, 7 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6669c56..b712578 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,6 @@
+### next version
+- `--git-status` launch option
+
<a name="v0.18.3"></a>
### v0.18.3 - 2020-06-30
Faster rendering (0.18.2 made it slower on some terminals)
diff --git a/src/app/app.rs b/src/app/app.rs
index ce89f77..419d54b 100644
--- a/src/app/app.rs
+++ b/src/app/app.rs
@@ -102,7 +102,11 @@ impl App {
for (idx, panel) in self.panels.as_mut_slice().iter_mut().enumerate() {
let focused = idx == self.active_panel_idx;
let skin = if focused { &skin.focused } else { &skin.unfocused };
- panel.display(w, focused, screen, skin, con)?;
+ time!(
+ Debug,
+ "display panel",
+ panel.display(w, focused, screen, skin, con)?,
+ );
}
Ok(())
}
diff --git a/src/browser/browser_state.rs b/src/browser/browser_state.rs
index dab6c85..bb9ced7 100644
--- a/src/browser/browser_state.rs
+++ b/src/browser/browser_state.rs
@@ -617,7 +617,16 @@ impl AppState for BrowserState {
self.with_new_options(screen, &|o| o.show_git_file_info ^= true, bang, con)
}
Internal::toggle_git_status => {
- self.with_new_options(screen, &|o| o.filter_by_git_status ^= true, bang, con)
+ self.with_new_options(
+ screen, &|o| {
+ if o.filter_by_git_status {
+ o.filter_by_git_status = false;
+ } else {
+ o.filter_by_git_status = true;
+ o.show_hidden = true;
+ }
+ }, bang, con
+ )
}
Internal::toggle_perm => {
self.with_new_options(screen, &|o| o.show_permissions ^= true, bang, con)
diff --git a/src/clap.rs b/src/clap.rs
index c64a10f..94dea93 100644
--- a/src/clap.rs
+++ b/src/clap.rs
@@ -46,6 +46,11 @@ pub fn clap_app() -> clap::App<'static, 'static> {
.help("Don't show git statuses on files"),
)
.arg(
+ clap::Arg::with_name("git-status")
+ .long("git-status")
+ .help("Only show files having an interesting git status, including hidden ones"),
+ )
+ .arg(
clap::Arg::with_name("hidden")
.short("h")
.long("hidden")
diff --git a/src/conf/default_conf.rs b/src/conf/default_conf.rs
index 21d6c83..1edba75 100644
--- a/src/conf/default_conf.rs
+++ b/src/conf/default_conf.rs
@@ -100,7 +100,7 @@ leave_broot = false
invocation = "git_diff"
shortcut = "gd"
leave_broot = false
-execution = "git diff {file}"
+execution = "git difftool -y {file}"
# If $PAGER isn't set on your computer, you should either set it
# or just replace it with your viewer of choice in the 'execution'
diff --git a/src/display/displayable_tree.rs b/src/display/displayable_tree.rs
index cb240b0..927601a 100644
--- a/src/display/displayable_tree.rs
+++ b/src/display/displayable_tree.rs
@@ -399,7 +399,6 @@ impl<'s, 't> DisplayableTree<'s, 't> {
let title = self.tree.lines[0].path.to_string_lossy();
cw.queue_str(&style, &title)?;
if self.in_app {
- self.extend_line_bg(cw, selected)?;
let title_len = title.chars().count();
if title_len < self.area.width as usize {
if let ComputationResult::Done(git_status) = &self.tree.git_status {
@@ -411,6 +410,7 @@ impl<'s, 't> DisplayableTree<'s, 't> {
git_status_display.write(cw, selected)?;
}
}
+ self.extend_line_bg(cw, selected)?;
}
Ok(())
}
diff --git a/src/tree/tree.rs b/src/tree/tree.rs
index 50042c1..654ae1c 100644
--- a/src/tree/tree.rs
+++ b/src/tree/tree.rs
@@ -147,7 +147,6 @@ impl Tree {
loop {
self.selection = (self.selection + ((l as i32) + dy) as usize) % l;
if self.lines[self.selection].is_selectable() {
- debug!("selected line score: {:?}", self.lines[self.selection].score);
break;
}
}
diff --git a/src/tree/tree_options.rs b/src/tree/tree_options.rs
index f5edb74..f5eb19d 100644
--- a/src/tree/tree_options.rs
+++ b/src/tree/tree_options.rs
@@ -79,6 +79,10 @@ impl TreeOptions {
} else if cli_args.is_present("no-only-folders") {
self.only_folders = false;
}
+ if cli_args.is_present("git-status") {
+ self.filter_by_git_status = true;
+ self.show_hidden = true;
+ }
if cli_args.is_present("hidden") {
self.show_hidden = true;
} else if cli_args.is_present("no-hidden") {
diff --git a/website/docs/install.md b/website/docs/install.md
index a8798f0..64c25a7 100644
--- a/website/docs/install.md
+++ b/website/docs/install.md
@@ -5,7 +5,7 @@ The current version of broot works on linux, mac and windows (win 10+).
!!! Note
**Windows users:** broot may need additional rights at first use in order to write its configuration file.
Some users on Windows also report problems with the colon. Remember that a space can be used instead of a colon.
- You should also use the new Powershell terminal and not the old cmd.exe.
+ You should also use the new Powershell terminal and not the old cmd.exe which isn't supported.
!!! Note
If you use cargo and there's a compilation error, it usually means you have an old version of the compiler, and you should update it (for example with `rustup update`).
diff --git a/website/docs/skins.md b/website/docs/skins.md
index ae8e31f..5c316ae 100644
--- a/website/docs/skins.md
+++ b/website/docs/skins.md
@@ -97,7 +97,12 @@ Currently supported attributes are:
* reverse
* underlined
-Note that some of them may be ignored by your terminal. Windows supports about none of them, for example.
+and also...
+
+* slowblink
+* rapidblink
+
+Note that some of them may be ignored by your terminal especially if you're not on a unix system.
The mapping between keys and screen parts may not always be obvious. Don't hesitate to come ask for help on [Miaou](https://miaou.dystroy.org/3490?broot).