diff options
author | Sebastian Thiel <sebastian.thiel@icloud.com> | 2020-03-29 18:02:39 +0800 |
---|---|---|
committer | Sebastian Thiel <sebastian.thiel@icloud.com> | 2020-03-29 18:02:39 +0800 |
commit | 164d8859ea0a1386dbd75a0a27dd0340e6605857 (patch) | |
tree | de460cf9960f59811b8112db166c69f34bfe2d7e /src | |
parent | d7d9a8bdd55ce6fccdc51d238e55e769c314205c (diff) |
Now it's way more intuitive, and you can basically do everything…
…even though it can still panic (and I don't see why due to the
alternate screen), I think one should not delete things from disk
while they are being added.
Diffstat (limited to 'src')
-rw-r--r-- | src/interactive/app/eventloop.rs | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/interactive/app/eventloop.rs b/src/interactive/app/eventloop.rs index 8e7069c..b7fa22b 100644 --- a/src/interactive/app/eventloop.rs +++ b/src/interactive/app/eventloop.rs @@ -174,8 +174,8 @@ impl TerminalApp { { terminal.hide_cursor()?; terminal.clear()?; - let mut display_options: DisplayOptions = options.clone().into(); - display_options.byte_vis = ByteVisualization::Bar; + let mut display: DisplayOptions = options.clone().into(); + display.byte_vis = ByteVisualization::Bar; let mut window = MainWindow::default(); let (keys_tx, keys_rx) = crossbeam_channel::unbounded(); match mode { @@ -219,14 +219,14 @@ impl TerminalApp { s.process_events( &mut window, traversal, - &mut display_options, + &mut display, terminal, fetch_buffered_key_events().into_iter(), )?; Ok(()) })?; - display_options.byte_vis = ByteVisualization::PercentageAndBar; + display.byte_vis = ByteVisualization::PercentageAndBar; Ok(TerminalApp { state: { let mut s = state.unwrap_or_else(|| { @@ -241,13 +241,17 @@ impl TerminalApp { } }); s.reset_message(); - s.entries = sorted_entries(&traversal.tree, traversal.root_index, s.sorting); - s.selected = s.entries.get(0).map(|b| b.index); + s.entries = sorted_entries( + &traversal.tree, + s.root, + s.sorting, + ); + s.selected = s.selected.or_else(|| s.entries.get(0).map(|b| b.index)); s }, - display: display_options, + display, traversal, - window: Default::default(), + window, }) } } |