From b70682ecb5d3a1d08577e7c7c9d576dbac4d1e8e Mon Sep 17 00:00:00 2001 From: Arijit Basu Date: Fri, 2 Apr 2021 05:59:56 +0530 Subject: [PATCH] Fix term resize handler --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/app.rs | 2 +- src/config.rs | 2 -- src/main.rs | 16 ++++++++++++---- 5 files changed, 15 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 792b7df..a436583 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1117,7 +1117,7 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "xplr" -version = "0.2.4" +version = "0.2.5" dependencies = [ "criterion", "crossterm", diff --git a/Cargo.toml b/Cargo.toml index ac1ce75..9d707c0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "xplr" -version = "0.2.4" # Update app.rs +version = "0.2.5" # Update app.rs authors = ["Arijit Basu "] edition = "2018" description = "An experimental, minimal, configurable TUI file explorer, stealing ideas from nnn and fzf." diff --git a/src/app.rs b/src/app.rs index 5287daa..ef1e553 100644 --- a/src/app.rs +++ b/src/app.rs @@ -11,7 +11,7 @@ use std::collections::VecDeque; use std::fs; use std::path::PathBuf; -pub const VERSION: &str = "v0.2.4"; // Update Cargo.toml +pub const VERSION: &str = "v0.2.5"; // Update Cargo.toml pub const TEMPLATE_TABLE_ROW: &str = "TEMPLATE_TABLE_ROW"; diff --git a/src/config.rs b/src/config.rs index 492dd27..a8c21ee 100644 --- a/src/config.rs +++ b/src/config.rs @@ -320,8 +320,6 @@ impl Default for KeyBindings { args: - -c - xdg-open "${XPLR_FOCUS_PATH:?}" &> /dev/null - - ClearScreen - - Refresh ctrl-l: help: clear diff --git a/src/main.rs b/src/main.rs index e341389..6bed415 100644 --- a/src/main.rs +++ b/src/main.rs @@ -91,10 +91,18 @@ fn main() -> Result<(), Error> { if !is_paused { if event::poll(std::time::Duration::from_millis(1)).unwrap() { - if let Event::Key(key) = event::read().unwrap() { - let key = Key::from_event(key); - let msg = app::MsgIn::Internal(app::InternalMsg::HandleKey(key)); - tx_key.send(app::Task::new(0, msg, Some(key))).unwrap(); + match event::read().unwrap() { + Event::Key(key) => { + let key = Key::from_event(key); + let msg = app::MsgIn::Internal(app::InternalMsg::HandleKey(key)); + tx_key.send(app::Task::new(0, msg, Some(key))).unwrap(); + } + + Event::Resize(_, _) => { + let msg = app::MsgIn::External(app::ExternalMsg::Refresh); + tx_key.send(app::Task::new(0, msg, None)).unwrap(); + } + _ => {} } } }