diff options
author | Canop <cano.petrole@gmail.com> | 2020-07-06 10:34:06 +0200 |
---|---|---|
committer | Canop <cano.petrole@gmail.com> | 2020-07-06 10:34:06 +0200 |
commit | 9d9ef0c205845ca70e433fb581981d2a76755283 (patch) | |
tree | b480f08b0e50cd220986a4e7f7d3ec4ec1b4cd2e | |
parent | 2e54f19aa835650049ad1118e7e8d6c815d04f6b (diff) |
avoid drawing the char at the bottom-right of the terminal
It makes some terminals flicker, so it's now done only once
at startup and never after
-rw-r--r-- | Cargo.lock | 2 | ||||
-rw-r--r-- | Cargo.toml | 2 | ||||
-rw-r--r-- | README.md | 4 | ||||
-rw-r--r-- | src/app/app.rs | 2 | ||||
-rw-r--r-- | src/display/areas.rs | 5 | ||||
-rw-r--r-- | src/display/screen.rs | 14 | ||||
-rw-r--r-- | website/docs/index.md | 1 |
7 files changed, 26 insertions, 4 deletions
@@ -84,7 +84,7 @@ dependencies = [ [[package]] name = "broot" -version = "0.18.5" +version = "0.18.6-dev" dependencies = [ "bet", "chrono", @@ -1,6 +1,6 @@ [package] name = "broot" -version = "0.18.5" +version = "0.18.6-dev" authors = ["dystroy <denys.seguret@gmail.com>"] repository = "https://github.com/Canop/broot" documentation = "https://dystroy.org/broot" @@ -117,7 +117,7 @@ And you can add shorcuts, for example a <kbd>ctrl</kbd> sequence or a function k If you want to display *sizes*, *dates* and *permissions*, do `br -sdp` which gets you this: -![replace ls](website/docs/img/20200628-sdp.png) +![replace ls](website/docs/img/20200704-sdp.png) You may also toggle options with a few keystrokes while inside broot. For example hitting a space, a `d` then enter shows you the dates. Or a space, then `h` then enter and you see hidden files. @@ -129,7 +129,7 @@ When sorting, the whole content of directories is taken into account. So if you If you start broot with the `--whale-spotting` option (or its shorcut `-w`), you get a mode tailored to "whale spotting" navigation, making it easy to determine what files or folders take space. -![size](website/docs/img/20200628-whale-spotting.png) +![size](website/docs/img/20200704-whale-spotting.png) And you keep all broot tools, like filtering or the ability to delete or open files and directories. diff --git a/src/app/app.rs b/src/app/app.rs index 69e0af4..ee4eff2 100644 --- a/src/app/app.rs +++ b/src/app/app.rs @@ -308,6 +308,8 @@ impl App { let skin = AppSkin::new(conf); + screen.clear_bottom_right_char(w, &skin.focused)?; + // if some commands were passed to the application // we execute them before even starting listening for events if let Some(unparsed_commands) = &con.launch_args.commands { diff --git a/src/display/areas.rs b/src/display/areas.rs index 23fe5f5..01685d4 100644 --- a/src/display/areas.rs +++ b/src/display/areas.rs @@ -102,6 +102,11 @@ impl Areas { }; let y = y + 1; areas.input = Area::new(x, y, panel_width, 1); + if slot_idx==nb_pos-1 { + // the char at the bottom right of the terminal should not be touched + // (it makes some terminals flicker) so the input area is one char shorter + areas.input.width -= 1; + } areas.purpose = if slot_idx > 0 { let area_width = panel_width / 2; Some(Area::new(x - area_width, y, area_width, 1)) diff --git a/src/display/screen.rs b/src/display/screen.rs index 3ea1fe0..ed93177 100644 --- a/src/display/screen.rs +++ b/src/display/screen.rs @@ -3,6 +3,7 @@ use { app::AppContext, conf::Conf, errors::ProgramError, + skin::PanelSkin, }, crossterm::{ cursor, @@ -58,4 +59,17 @@ impl Screen { } Ok(()) } + /// just clears the char at the bottom right. + /// (any redraw of this position makes the whole terminal flicker on some + /// terminals like win/conemu, so we draw it only once at start of the + /// app) + pub fn clear_bottom_right_char( + &self, + w: &mut W, + panel_skin: &PanelSkin, + ) -> Result<(), ProgramError> { + self.goto(w, self.width, self.height)?; + panel_skin.styles.default.queue(w, ' ')?; + Ok(()) + } } diff --git a/website/docs/index.md b/website/docs/index.md index d8518a8..c2a5590 100644 --- a/website/docs/index.md +++ b/website/docs/index.md @@ -35,6 +35,7 @@ Most useful keys for this: * the letters of what you're looking for * <kbd>enter</kbd> to select a directory (staying in broot) * <kbd>esc</kbd> to get back to the previous state or clear your search +* <kbd class=b>↓</kbd> and <kbd class=b>↑</kbd> may be used to move the selection * <kbd>alt</kbd><kbd>enter</kbd> to get back to the shell having `cd` to the selected directory * `:q` if you just want to quit (you can use <kbd>ctrl</kbd><kbd>q</kbd> if you prefer) |