Skip to content

Commit

Permalink
Fix: PreviewType naming
Browse files Browse the repository at this point in the history
  • Loading branch information
kyoheiu committed Jan 11, 2025
1 parent 871584e commit 9b14cc4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ pub struct Layout {
#[derive(Debug, PartialEq, PartialOrd, Eq, Ord, Clone)]
pub enum PreviewType {
NotReadable,
TooBigImage,
TooBigText,
TooLargeImage,
TooLargeText,
Directory,
Image,
Text,
Expand Down Expand Up @@ -186,10 +186,10 @@ impl Layout {
Some(PreviewType::NotReadable) => {
print!("(file not readable)");
}
Some(PreviewType::TooBigImage) => {
Some(PreviewType::TooLargeImage) => {
print!("(image too big for preview: over 100MB)");
}
Some(PreviewType::TooBigText) => {
Some(PreviewType::TooLargeText) => {
print!("(text too big for preview: over 1MB)");
}
Some(PreviewType::Directory) => {
Expand Down
4 changes: 2 additions & 2 deletions src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1972,13 +1972,13 @@ fn check_zoxide() -> bool {
/// Set content type from ItemInfo.
fn set_preview_content_type(item: &mut ItemInfo) {
if item.file_size > MAX_SIZE_TO_PREVIEW {
item.preview_type = Some(PreviewType::TooBigImage);
item.preview_type = Some(PreviewType::TooLargeImage);
} else if is_supported_image(item) {
item.preview_type = Some(PreviewType::Image);
} else if let Ok(content) = &std::fs::read(&item.file_path) {
if content_inspector::inspect(content).is_text() {
if item.file_size > MAX_SIZE_TO_PREVIEW_TEXT {
item.preview_type = Some(PreviewType::TooBigText);
item.preview_type = Some(PreviewType::TooLargeText);
return;
}
if let Ok(content) = String::from_utf8(content.to_vec()) {
Expand Down

0 comments on commit 9b14cc4

Please sign in to comment.