Minor fixes

pull/3/head
Arijit Basu 3 years ago
parent f176655325
commit 2c56b80fde
No known key found for this signature in database
GPG Key ID: 7D7BF809E7378863

2
Cargo.lock generated

@ -1117,7 +1117,7 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "xplr"
version = "0.2.3"
version = "0.2.4"
dependencies = [
"criterion",
"crossterm",

@ -1,6 +1,6 @@
[package]
name = "xplr"
version = "0.2.3" # Update app.rs
version = "0.2.4" # Update app.rs
authors = ["Arijit Basu <sayanarijit@gmail.com>"]
edition = "2018"
description = "An experimental, minimal, configurable TUI file explorer, stealing ideas from nnn and fzf."

@ -41,7 +41,9 @@ cargo install xplr
```bash
mkdir -p ~/.config/xplr
echo "PrintAppStateAndQuit" | xplr | yq ".config" -y | tee ~/.config/xplr/config.yml
xplr | yq ".config" -y | tee ~/.config/xplr/config.yml
# When the app loads, press `#`
```
3. Check the key bindings in the config file.

@ -11,7 +11,7 @@ use std::collections::VecDeque;
use std::fs;
use std::path::PathBuf;
pub const VERSION: &str = "v0.2.3"; // Update Cargo.toml
pub const VERSION: &str = "v0.2.4"; // Update Cargo.toml
pub const TEMPLATE_TABLE_ROW: &str = "TEMPLATE_TABLE_ROW";

@ -282,7 +282,7 @@ impl Default for KeyBindings {
args: []
/:
help: find
help: search
messages:
- Call:
command: bash
@ -451,6 +451,17 @@ impl Default for Config {
- ResetInputBuffer
- SwitchMode: default
esc:
help: cancel
messages:
- ResetInputBuffer
- SwitchMode: default
q:
help: cancel & quit
messages:
- Terminate
on_number:
help: input
messages:

@ -297,7 +297,7 @@ fn draw_help_menu<B: Backend>(f: &mut Frame<B>, rect: Rect, app: &app::App, _: &
.map(|l| Row::new(vec![Cell::from(l)]))
.chain(mode.key_bindings.on_key.iter().filter_map(|(k, a)| {
a.help.clone().map(|h| {
Row::new(vec![Cell::from(h.to_string()), Cell::from(k.to_string())])
Row::new(vec![Cell::from(k.to_string()), Cell::from(h.to_string())])
})
}))
.chain(
@ -307,7 +307,7 @@ fn draw_help_menu<B: Backend>(f: &mut Frame<B>, rect: Rect, app: &app::App, _: &
.map(|a| ("a-Z", a.help.clone()))
.filter_map(|(k, mh)| {
mh.map(|h| {
Row::new(vec![Cell::from(h.to_string()), Cell::from(k.to_string())])
Row::new(vec![Cell::from(k.to_string()), Cell::from(h.to_string())])
})
}),
)
@ -318,7 +318,7 @@ fn draw_help_menu<B: Backend>(f: &mut Frame<B>, rect: Rect, app: &app::App, _: &
.map(|a| ("0-9", a.help.clone()))
.filter_map(|(k, mh)| {
mh.map(|h| {
Row::new(vec![Cell::from(h.to_string()), Cell::from(k.to_string())])
Row::new(vec![Cell::from(k.to_string()), Cell::from(h.to_string())])
})
}),
)
@ -329,7 +329,7 @@ fn draw_help_menu<B: Backend>(f: &mut Frame<B>, rect: Rect, app: &app::App, _: &
.map(|a| ("spcl chars", a.help.clone()))
.filter_map(|(k, mh)| {
mh.map(|h| {
Row::new(vec![Cell::from(h.to_string()), Cell::from(k.to_string())])
Row::new(vec![Cell::from(k.to_string()), Cell::from(h.to_string())])
})
}),
)
@ -365,24 +365,25 @@ fn draw_input_buffer<B: Backend>(f: &mut Frame<B>, rect: Rect, app: &app::App, _
pub fn draw<B: Backend>(f: &mut Frame<B>, app: &app::App, hb: &Handlebars) {
let rect = f.size();
let chunks = Layout::default()
.direction(Direction::Vertical)
.margin(1)
.constraints([TUIConstraint::Max(rect.height - 5), TUIConstraint::Max(3)].as_ref())
.split(rect);
let upper_chunks = Layout::default()
let chunks = Layout::default()
.direction(Direction::Horizontal)
.constraints([TUIConstraint::Percentage(70), TUIConstraint::Percentage(30)].as_ref())
.split(rect);
let left_chunks = Layout::default()
.direction(Direction::Vertical)
.constraints([TUIConstraint::Length(rect.height - 3), TUIConstraint::Min(3)].as_ref())
.split(chunks[0]);
let upper_left_chunks = Layout::default()
let right_chunks = Layout::default()
.direction(Direction::Vertical)
.constraints([TUIConstraint::Percentage(50), TUIConstraint::Percentage(50)].as_ref())
.split(upper_chunks[1]);
.split(chunks[1]);
draw_input_buffer(f, chunks[1], app, hb);
draw_table(f, upper_chunks[0], app, hb);
draw_selected(f, upper_left_chunks[0], app, hb);
draw_help_menu(f, upper_left_chunks[1], app, hb);
draw_table(f, left_chunks[0], app, hb);
draw_input_buffer(f, left_chunks[1], app, hb);
draw_selected(f, right_chunks[0], app, hb);
draw_help_menu(f, right_chunks[1], app, hb);
}

Loading…
Cancel
Save