Skip to content

Commit

Permalink
feat(ultracompact): make compact an enum, not a bool
Browse files Browse the repository at this point in the history
  • Loading branch information
philtweir committed Oct 20, 2024
1 parent 2553717 commit d576674
Show file tree
Hide file tree
Showing 2 changed files with 130 additions and 104 deletions.
19 changes: 7 additions & 12 deletions crates/atuin/src/command/client/search/inspector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use ratatui::{
use super::duration::format_duration;

use super::super::theme::{Meaning, Theme};
use super::interactive::{InputAction, State};
use super::interactive::{to_compactness, Compactness, InputAction, State};

#[allow(clippy::cast_sign_loss)]
fn u64_or_zero(num: i64) -> u64 {
Expand Down Expand Up @@ -290,20 +290,15 @@ pub fn draw(
settings: &Settings,
theme: &Theme,
) {
let compact = match settings.style {
atuin_client::settings::Style::Auto => f.size().height < 14,
atuin_client::settings::Style::Compact => true,
atuin_client::settings::Style::Full => false,
};

if compact {
draw_compact(f, chunk, history, stats, theme);
} else {
draw_full(f, chunk, history, stats, theme);
let compactness = to_compactness(f, settings);

match compactness {
Compactness::Ultracompact => draw_ultracompact(f, chunk, history, stats, theme),
_ => draw_full(f, chunk, history, stats, theme),
}
}

pub fn draw_compact(
pub fn draw_ultracompact(
f: &mut Frame<'_>,
chunk: Rect,
history: &History,
Expand Down
Loading

0 comments on commit d576674

Please sign in to comment.