diff --git a/CHANGELOG.md b/CHANGELOG.md index 10089591..985eaa02 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,17 +1,21 @@ + +### v0.6.2 - 2019-02-18 +- all colors can be configured in conf.toml + -## v0.6.1 - 2019-02-14 +### v0.6.1 - 2019-02-14 - complete verbs handling in help screen - faster regex search - fix missing version in `broot -V` -## v0.6.0 - 2019-02-12 -### Major changes +### v0.6.0 - 2019-02-12 +##### Major changes - broot now installs the **br** shell function itself *(for bash and zsh, help welcome for other shells)* - new verb `:toggle_trim_root` allows to keep all root children - verbs can refer to `{directory}` which is the parent dir when a simple file is selected - user configured verbs can be launched from parent shell too (like is done for `cd {directory}`) -### Minor changes +##### Minor changes - allow page up and page down on help screen - fuzzy pattern: increase score of match starting after word separator - better handle errors on a few cases of non suitable root (like passing an invalid path) @@ -19,16 +23,16 @@ - add a scrollbar on help screen -## v0.5.2 - 2019-02-04 +### v0.5.2 - 2019-02-04 - More responsive on slow disks - fix a link to documentation in autogenerated conf -## v0.5.1 - 2019-02-03 +### v0.5.1 - 2019-02-03 - alt-enter now executes `:cd` -## v0.5.0 - 2019-01-30 +### v0.5.0 - 2019-01-30 - patterns can be regexes (add a slash before or after the pattern) - configuration parsing more robust - no need to put all verbs in config: builtins are accessible even without being in config @@ -39,31 +43,31 @@ - more precise display of file/dir sizes -## 0.4.7 - 2019-01-21 +### 0.4.7 - 2019-01-21 - fix some cases of panic on broot quitting - new `--cmd` program argument allows passing a sequence of commands to be immediately executed (see [updated documentation](https://github.com/Canop/broot/blob/master/documentation.md#passing-commands-as-program-argument)) - better handling of symlink (display type of target, show invalid links, allow verbs on target) - compiled with rustc 1.32 which brings about 4% improvements in perfs compared to 1.31 -## v0.4.6 - 2019-01-12 +### v0.4.6 - 2019-01-12 - fix configured verbs not correctly handling paths with spaces - fix `:q` not instantly quitting broot when computing size - hit enter on tree root correctly quits broot -## v0.4.5 - 2019-01-11 +### v0.4.5 - 2019-01-11 - Faster search, mainly -## v0.4.3 - 2019-01-08 +### v0.4.3 - 2019-01-08 - Faster search and directory size computation. -## v0.4.2 - 2019-01-07 +### v0.4.2 - 2019-01-07 - more complete search if time allows - search pattern kept after verb execution -## v0.4.1 - 2019-01-07 +### v0.4.1 - 2019-01-07 - first public release diff --git a/Cargo.lock b/Cargo.lock index 35bb7111..1521406d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ [[package]] name = "aho-corasick" -version = "0.6.9" +version = "0.6.10" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -34,7 +34,7 @@ name = "broot" version = "0.6.1" dependencies = [ "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)", - "custom_error 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "custom_error 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "directories 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "jemallocator 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", @@ -88,7 +88,7 @@ dependencies = [ [[package]] name = "custom_error" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -183,7 +183,7 @@ name = "regex" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", + "aho-corasick 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "regex-syntax 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -200,7 +200,7 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.87" +version = "1.0.88" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -268,7 +268,7 @@ name = "toml" version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.88 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -319,7 +319,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" [metadata] -"checksum aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "1e9a933f4e58658d7b12defcf96dc5c720f20832deebe3e0a19efd3b6aaeeb9e" +"checksum aho-corasick 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "81ce3d38065e618af2d7b77e10c5ad9a069859b4be3c2250f674af3840d9c8a5" "checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" "checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652" "checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" @@ -328,7 +328,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "082bb9b28e00d3c9d39cc03e64ce4cea0f1bb9b3fde493f0cbc008472d22bdf4" "checksum chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "45912881121cb26fad7c38c17ba7daa18764771836b34fab7d3fbd93ed633878" "checksum clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b957d88f4b6a63b9d70d5f454ac8011819c6efa7727858f458ab71c756ce2d3e" -"checksum custom_error 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "994da086d8391ca0b3cceebb4478fc761199fc6850bf3c51de8f0f5dae6fddca" +"checksum custom_error 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9efb928d6df5bf5686767e19c842138d5f4182acd8f8d23663a87acc1aa38b0b" "checksum directories 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "72d337a64190607d4fcca2cb78982c5dd57f4916e19696b48a575fa746b6cb0f" "checksum fs_extra 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5f2a4a2034423744d2cc7ca2068453168dcdb82c438419e639a26bd87839c674" "checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" @@ -344,7 +344,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" "checksum regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "37e7cbbd370869ce2e8dff25c7018702d10b21a20ef7135316f8daecd6c25b7f" "checksum regex-syntax 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "8c2f35eedad5295fdf00a63d7d4b238135723f92b434ec06774dad15c7ab0861" -"checksum serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)" = "2e20fde37801e83c891a2dc4ebd3b81f0da4d1fb67a9e0a2a3b921e2536a58ee" +"checksum serde 1.0.88 (registry+https://github.com/rust-lang/crates.io-index)" = "9f301d728f2b94c9a7691c90f07b0b4e8a4517181d9461be94c04bddeb4bd850" "checksum simplelog 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e95345f185d5adeb8ec93459d2dc99654e294cc6ccf5b75414d8ea262de9a13" "checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550" "checksum term 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5e6b677dd1e8214ea1ef4297f85dbcbed8e8cdddb561040cc998ca2551c37561" diff --git a/Cargo.toml b/Cargo.toml index 7417a69b..b76cdaf0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "broot" -version = "0.6.1" +version = "0.6.2" authors = ["dystroy "] repository = "https://github.com/Canop/broot" description = "Fuzzy Search + tree + cd" diff --git a/src/help_states.rs b/src/help_states.rs index fa396c68..92251ca3 100644 --- a/src/help_states.rs +++ b/src/help_states.rs @@ -8,7 +8,6 @@ use crate::commands::{Action, Command}; use crate::conf::Conf; use crate::screen_text::{Text, TextTable}; use crate::screens::{Screen, ScreenArea}; -use crate::skin::Skin; use crate::status::Status; use crate::task_sync::TaskLifetime; use crate::verbs::{PrefixSearchResult, Verb, VerbExecutor}; @@ -50,7 +49,7 @@ impl AppState for HelpState { AppStateCmdResult::Keep } Action::ScrollPage(dp) => { - self.area.try_scroll(*dp * i32::from(self.area.bottom-self.area.top)); + self.area.try_scroll(*dp * (self.area.height()-1)); AppStateCmdResult::Keep } _ => AppStateCmdResult::Keep, diff --git a/src/screen_text.rs b/src/screen_text.rs index 10fbd961..0dc0d87c 100644 --- a/src/screen_text.rs +++ b/src/screen_text.rs @@ -102,19 +102,19 @@ impl<'a, R> TextCol<'a, R> {} /// A small utility to format some data in a tabular way on screen pub struct TextTable<'a, R> { cols: Vec>, - bar: String, // according to skin + md_bar: String, // according to skin } impl<'a, R> TextTable<'a, R> { pub fn new(skin: &Skin) -> TextTable<'a, R> { - let bar = format!( + let md_bar = format!( " {}│{} ", skin.table_border.fg, skin.reset.fg, ); TextTable { cols: Vec::new(), - bar, + md_bar, } } pub fn add_col(&mut self, title: &str, extract: &'a Fn(&'a R) -> &str) { @@ -140,7 +140,7 @@ impl<'a, R> TextTable<'a, R> { self.compute_col_widths(&rows); let mut header = String::new(); for col in &self.cols { - header.push_str(&self.bar); + header.push_str(&self.md_bar); // we're lazy here: // we add some bold, and add 4 for the width because we know the * won't // show up on screen. @@ -150,7 +150,7 @@ impl<'a, R> TextTable<'a, R> { for row in rows { let mut line = String::new(); for (i, col) in self.cols.iter().enumerate() { - line.push_str(&self.bar); + line.push_str(&self.md_bar); let s = (col.extract)(row); if i == self.cols.len() - 1 { line.push_str(&text.md_to_tty(s)); diff --git a/src/skin.rs b/src/skin.rs index 40d9cec5..ebca186c 100644 --- a/src/skin.rs +++ b/src/skin.rs @@ -1,10 +1,14 @@ -use std::io::{self, Write}; - -use crate::screens::Screen; - +/// Defines the Skin structure with its defautl value. +/// +/// A skin is a collection of skin entries and the +/// store of all color changing TTY codes used by +/// the application. It can be changed by configuration. use std::collections::HashMap; use termion::color::{self, *}; +/// a Skin entry is a couple of strings, one for the foreground +/// and one for the background, each one made of TTY escape +/// codes defining color changes. pub struct SkinEntry { pub fg: String, pub bg: String, @@ -46,26 +50,26 @@ macro_rules! Skin { } Skin! { - status_normal: White, AnsiValue::grayscale(2) - status_error: Red, AnsiValue::grayscale(2) - tree: AnsiValue::grayscale(5), Reset - selected_line: Reset, AnsiValue::grayscale(2) - permissions: AnsiValue::grayscale(15), Reset - size_text: AnsiValue::grayscale(15), Reset - size_bar_full: Reset, Magenta - size_bar_void: Reset, AnsiValue::grayscale(2) - file: White, Reset - directory: LightBlue, Reset char_match: Green, Reset - link: LightMagenta, Reset + code: Reset, AnsiValue::grayscale(2) + directory: LightBlue, Reset + file: White, Reset file_error: Red, Reset - unlisted: AnsiValue::grayscale(13), Reset - input: White, Reset - flag_label: AnsiValue::grayscale(14), AnsiValue::grayscale(1) + flag_label: AnsiValue::grayscale(12), AnsiValue::grayscale(1) flag_value: AnsiValue::grayscale(16), AnsiValue::grayscale(1) - code: Reset, AnsiValue::grayscale(2) - table_border: AnsiValue::grayscale(8), Reset + input: White, Reset + link: LightMagenta, Reset + permissions: AnsiValue::grayscale(15), Reset + selected_line: Reset, AnsiValue::grayscale(3) + size_bar_full: Reset, Magenta + size_bar_void: Reset, AnsiValue::grayscale(2) + size_text: AnsiValue::grayscale(15), Reset spinner: AnsiValue::grayscale(10), AnsiValue::grayscale(2) + status_error: Red, AnsiValue::grayscale(2) + status_normal: White, AnsiValue::grayscale(2) + table_border: AnsiValue::grayscale(8), Reset + tree: AnsiValue::grayscale(5), Reset + unlisted: AnsiValue::grayscale(13), Reset } diff --git a/src/status.rs b/src/status.rs index 4c27ad31..1f7ea0ab 100644 --- a/src/status.rs +++ b/src/status.rs @@ -5,7 +5,6 @@ use std::io::{self, Write}; use termion; use crate::screens::Screen; -use crate::skin::Skin; pub trait Status { fn write_status_text(&mut self, text: &str) -> io::Result<()>;