fix(layout): double check whether preview is enabled (#499)

This commit is contained in:
nkxxll 2025-05-08 22:03:47 +02:00 committed by GitHub
parent 2b2654b6aa
commit cd33151bac
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 5 deletions

View File

@ -179,12 +179,14 @@ impl Ord for Ctx {
/// This layout can then be sent back to the main thread to serve for tasks where having that
/// information can be useful or lead to optimizations.
pub fn draw(ctx: &Ctx, f: &mut Frame<'_>, area: Rect) -> Result<Layout> {
let show_preview =
ctx.config.ui.show_preview_panel && ctx.tv_state.preview_state.enabled;
let show_remote = !matches!(ctx.tv_state.mode, Mode::Channel);
let layout =
Layout::build(area, &ctx.config.ui, show_remote, show_preview);
let layout = Layout::build(
area,
&ctx.config.ui,
show_remote,
ctx.tv_state.preview_state.enabled,
);
// help bar (metadata, keymaps, logo)
draw_help_bar(

View File

@ -140,7 +140,6 @@ impl Layout {
ui_config: &UiConfig,
show_remote: bool,
show_preview: bool,
//
) -> Self {
let show_preview = show_preview && ui_config.show_preview_panel;
let dimensions = Dimensions::from(ui_config.ui_scale);