From 34538845ba899a6892c6bbc10d294f209b78fdd7 Mon Sep 17 00:00:00 2001 From: Jeff Zhao Date: Mon, 21 Jun 2021 19:44:17 -0400 Subject: fix file sizes not appearing when filename too long (#78) * fix file sizes not appearing when filename too long * refactor previewing code - event.rs is moved out of utils as its an integral part of the codebase - load_child.rs has been replaced with preview module - moved previewing logic inside run.rs instead of spreading it across multiple commands * revert tui_dirlist_detailed to use MIN_LEFT_LABEL_WIDTH - add previewing loading trigger to mouse input as well * fix: right label disappears (#79) Co-authored-by: DLFW --- src/run.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/run.rs') diff --git a/src/run.rs b/src/run.rs index fa02d3e..fd1a3af 100644 --- a/src/run.rs +++ b/src/run.rs @@ -3,12 +3,12 @@ use termion::event::Event; use crate::commands::{AppExecute, CommandKeybind, KeyCommand}; use crate::config::AppKeyMapping; use crate::context::AppContext; +use crate::event::AppEvent; +use crate::preview::preview_default; use crate::tab::JoshutoTab; use crate::ui; use crate::ui::views::{TuiCommandMenu, TuiView}; -use crate::util::event::AppEvent; use crate::util::input; -use crate::util::load_child::LoadChild; use crate::util::to_string::ToString; pub fn run( @@ -23,7 +23,7 @@ pub fn run( context.tab_context_mut().push_tab(tab); // trigger a preview of child - let _ = LoadChild::load_child(context); + preview_default::load_preview(context, backend); } while !context.exit { @@ -40,6 +40,7 @@ pub fn run( match event { AppEvent::Termion(Event::Mouse(event)) => { input::process_mouse(event, context, backend); + preview_default::load_preview(context, backend); } AppEvent::Termion(key) => { if !context.message_queue_ref().is_empty() { @@ -82,6 +83,7 @@ pub fn run( }, } context.flush_event(); + preview_default::load_preview(context, backend); } event => input::process_noninteractive(event, context), } -- cgit v1.2.3