mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
Format
This commit is contained in:
parent
218e9310e9
commit
391cf82cce
4 changed files with 24 additions and 34 deletions
|
|
@ -21,4 +21,4 @@ ratatui = "^0"
|
||||||
tokio = { version = "^1", features = [ "parking_lot", "io-util", "process" ] }
|
tokio = { version = "^1", features = [ "parking_lot", "io-util", "process" ] }
|
||||||
|
|
||||||
# Logging
|
# Logging
|
||||||
tracing = {version = "^0", features = ["max_level_debug", "release_max_level_warn"]}
|
tracing = { version = "^0", features = [ "max_level_debug", "release_max_level_warn" ] }
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,9 @@
|
||||||
use std::cmp::max;
|
use std::{cmp::max, path::PathBuf, process::Stdio};
|
||||||
use std::{path::PathBuf, process::Stdio};
|
|
||||||
use tracing::debug;
|
|
||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use ratatui::prelude::Rect;
|
use ratatui::prelude::Rect;
|
||||||
use tokio::{
|
use tokio::{io::AsyncWriteExt, process::{Child, Command}, sync::mpsc::{self, UnboundedSender}};
|
||||||
io::AsyncWriteExt,
|
use tracing::debug;
|
||||||
process::{Child, Command},
|
|
||||||
sync::mpsc::{self, UnboundedSender},
|
|
||||||
};
|
|
||||||
use yazi_config::PREVIEW;
|
use yazi_config::PREVIEW;
|
||||||
|
|
||||||
use crate::Adaptor;
|
use crate::Adaptor;
|
||||||
|
|
@ -40,10 +35,8 @@ impl Ueberzug {
|
||||||
|
|
||||||
fn adjust_rect(mut rect: Rect) -> Rect {
|
fn adjust_rect(mut rect: Rect) -> Rect {
|
||||||
let cfg = &PREVIEW.ueberzug;
|
let cfg = &PREVIEW.ueberzug;
|
||||||
rect.x =
|
rect.x = max((rect.x as f64 / cfg.scale_down_factor + cfg.x_offset) as i32, 0) as u16;
|
||||||
max((rect.x as f64 / cfg.scale_down_factor + cfg.x_offset) as i32, 0) as u16;
|
rect.y = max((rect.y as f64 / cfg.scale_down_factor + cfg.y_offset) as i32, 0) as u16;
|
||||||
rect.y =
|
|
||||||
max((rect.y as f64 / cfg.scale_down_factor + cfg.y_offset) as i32, 0) as u16;
|
|
||||||
rect.width =
|
rect.width =
|
||||||
max((rect.width as f64 / cfg.scale_down_factor + cfg.width_offset) as i32, 0) as u16;
|
max((rect.width as f64 / cfg.scale_down_factor + cfg.width_offset) as i32, 0) as u16;
|
||||||
rect.height =
|
rect.height =
|
||||||
|
|
|
||||||
|
|
@ -14,15 +14,15 @@ max_width = 600
|
||||||
max_height = 900
|
max_height = 900
|
||||||
cache_dir = ""
|
cache_dir = ""
|
||||||
|
|
||||||
[preview.ueberzug]
|
[preview.ueberzug]
|
||||||
# Scale down the coordinate and size of image preview that is incorrectly scaled
|
# Scale down the coordinate and size of image preview that is incorrectly scaled
|
||||||
# up by ueberzugpp in Wayland (tested under Hyprland). Example usage: if your
|
# up by ueberzugpp in Wayland (tested under Hyprland). Example usage: if your
|
||||||
# monitor has a 2.0 scale factor, you should pass 2.0 here.
|
# monitor has a 2.0 scale factor, you should pass 2.0 here.
|
||||||
scale_down_factor = 1.0
|
scale_down_factor = 1.0
|
||||||
x_offset = 0.0
|
x_offset = 0.0
|
||||||
y_offset = 0.0
|
y_offset = 0.0
|
||||||
width_offset = 0.0
|
width_offset = 0.0
|
||||||
height_offset = 0.0
|
height_offset = 0.0
|
||||||
|
|
||||||
[opener]
|
[opener]
|
||||||
edit = [
|
edit = [
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,4 @@
|
||||||
use std::{
|
use std::{path::{Path, PathBuf}, time::{self, SystemTime}};
|
||||||
path::{Path, PathBuf},
|
|
||||||
time::{self, SystemTime},
|
|
||||||
};
|
|
||||||
|
|
||||||
use md5::{Digest, Md5};
|
use md5::{Digest, Md5};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
|
|
@ -12,16 +9,16 @@ use crate::{xdg::Xdg, MERGED_YAZI};
|
||||||
#[derive(Debug, Deserialize)]
|
#[derive(Debug, Deserialize)]
|
||||||
pub struct UeberzugPreview {
|
pub struct UeberzugPreview {
|
||||||
pub scale_down_factor: f64,
|
pub scale_down_factor: f64,
|
||||||
pub x_offset: f64,
|
pub x_offset: f64,
|
||||||
pub y_offset: f64,
|
pub y_offset: f64,
|
||||||
pub width_offset: f64,
|
pub width_offset: f64,
|
||||||
pub height_offset: f64,
|
pub height_offset: f64,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct Preview {
|
pub struct Preview {
|
||||||
pub tab_size: u32,
|
pub tab_size: u32,
|
||||||
pub max_width: u32,
|
pub max_width: u32,
|
||||||
pub max_height: u32,
|
pub max_height: u32,
|
||||||
|
|
||||||
pub cache_dir: PathBuf,
|
pub cache_dir: PathBuf,
|
||||||
|
|
@ -37,8 +34,8 @@ impl Default for Preview {
|
||||||
}
|
}
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
struct Shadow {
|
struct Shadow {
|
||||||
tab_size: u32,
|
tab_size: u32,
|
||||||
max_width: u32,
|
max_width: u32,
|
||||||
max_height: u32,
|
max_height: u32,
|
||||||
|
|
||||||
cache_dir: Option<String>,
|
cache_dir: Option<String>,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue