mirror of
https://github.com/sayanarijit/xplr.git
synced 2024-09-11 11:05:39 +03:00
Sync branch (#677)
- Selection indicator in input and logs pane title for people who hide the selection pane.
This commit is contained in:
commit
1629398adf
@ -219,7 +219,7 @@ cargo install --locked xplr
|
||||
[4]: https://github.com/sayanarijit/xplr/watchers
|
||||
[5]: https://repology.org/badge/vertical-allrepos/xplr.svg
|
||||
[6]: https://repology.org/project/xplr/versions
|
||||
[7]: https://archlinux.org/packages/community/x86_64/xplr
|
||||
[7]: https://archlinux.org/packages/extra/x86_64/xplr
|
||||
[8]: https://aur.archlinux.org/packages/?O=0&SeB=n&K=xplr&outdated=&SB=n&SO=a&PP=50&do_Search=Go
|
||||
[9]: https://github.com/shubham-cpp/void-pkg-templates
|
||||
[10]: https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/file-managers/xplr/default.nix
|
||||
|
21
src/ui.rs
21
src/ui.rs
@ -40,6 +40,15 @@ fn read_only_indicator(app: &app::App) -> &str {
|
||||
}
|
||||
}
|
||||
|
||||
fn selection_indicator(app: &app::App) -> String {
|
||||
let count = app.selection.len();
|
||||
if count == 0 {
|
||||
String::new()
|
||||
} else {
|
||||
format!(" {{{count} sel}}")
|
||||
}
|
||||
}
|
||||
|
||||
pub fn string_to_text<'a>(string: String) -> Text<'a> {
|
||||
if *NO_COLOR {
|
||||
Text::raw(string)
|
||||
@ -991,7 +1000,12 @@ fn draw_input_buffer<B: Backend>(
|
||||
.scroll((0, scroll))
|
||||
.block(block(
|
||||
config,
|
||||
format!(" Input [{}{}] ", app.mode.name, read_only_indicator(app)),
|
||||
format!(
|
||||
" Input [{}{}]{} ",
|
||||
app.mode.name,
|
||||
read_only_indicator(app),
|
||||
selection_indicator(app),
|
||||
),
|
||||
));
|
||||
|
||||
f.render_widget(input_buf, layout_size);
|
||||
@ -1187,16 +1201,17 @@ fn draw_logs<B: Backend>(
|
||||
let logs_count = if logs_count == 0 {
|
||||
String::new()
|
||||
} else {
|
||||
format!("({logs_count}) ")
|
||||
format!(" ({logs_count})")
|
||||
};
|
||||
|
||||
let logs_list = List::new(logs).block(block(
|
||||
config,
|
||||
format!(
|
||||
" Logs {}[{}{}] ",
|
||||
" Logs{} [{}{}]{} ",
|
||||
logs_count,
|
||||
app.mode.name,
|
||||
read_only_indicator(app),
|
||||
selection_indicator(app)
|
||||
),
|
||||
));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user