This commit is contained in:
sxyazi 2023-09-24 11:48:31 +08:00
parent 6bdb7b9e04
commit 442bb1a5d0
No known key found for this signature in database
3 changed files with 8 additions and 2 deletions

View file

@ -19,6 +19,12 @@ impl<'a> Folder<'a> {
Self { cx, folder, is_preview: false, is_selection: false, is_find: false }
}
#[inline]
pub(super) fn with_preview(mut self, state: bool) -> Self {
self.is_preview = state;
self
}
#[inline]
pub(super) fn with_selection(mut self, state: bool) -> Self {
self.is_selection = state;

View file

@ -2,7 +2,7 @@ use config::MANAGER;
use ratatui::{buffer::Buffer, layout::{self, Constraint, Direction, Rect}, widgets::{Block, Borders, Padding, Widget}};
use super::{Folder, Preview};
use crate::context::Ctx;
use crate::Ctx;
pub(crate) struct Layout<'a> {
cx: &'a Ctx,

View file

@ -29,7 +29,7 @@ impl<'a> Widget for Preview<'a> {
match &preview.lock.as_ref().unwrap().data {
PreviewData::Folder => {
if let Some(folder) = manager.active().history(hovered) {
Folder::new(self.cx, folder).render(area, buf);
Folder::new(self.cx, folder).with_preview(true).render(area, buf);
}
}
PreviewData::Text(s) => {