mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
fix: respect the user's image_alloc setting for the built-in ImageMagick previewer
This commit is contained in:
parent
953d567c63
commit
5884a64250
2 changed files with 13 additions and 1 deletions
|
|
@ -37,6 +37,7 @@ function M:preload(job)
|
|||
"-auto-orient",
|
||||
"JPG:" .. tostring(cache),
|
||||
})
|
||||
:env("MAGICK_MEMORY_LIMIT", rt.tasks.image_alloc)
|
||||
:env("MAGICK_THREAD_LIMIT", 1)
|
||||
:status()
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use mlua::{IntoLua, Lua, LuaSerdeExt, SerializeOptions, Value};
|
||||
use yazi_boot::ARGS;
|
||||
use yazi_config::{MGR, PREVIEW, THEME};
|
||||
use yazi_config::{MGR, PREVIEW, TASKS, THEME};
|
||||
|
||||
use crate::{Composer, url::Url};
|
||||
|
||||
|
|
@ -19,6 +19,7 @@ impl<'a> Runtime<'a> {
|
|||
b"mgr" => Self::mgr(lua)?,
|
||||
b"plugin" => super::Plugin::compose(lua)?,
|
||||
b"preview" => Self::preview(lua)?,
|
||||
b"tasks" => Self::tasks(lua)?,
|
||||
_ => return Ok(Value::Nil),
|
||||
}
|
||||
.into_lua(lua)
|
||||
|
|
@ -62,6 +63,16 @@ impl<'a> Runtime<'a> {
|
|||
})
|
||||
}
|
||||
|
||||
fn tasks(lua: &Lua) -> mlua::Result<Value> {
|
||||
Composer::make(lua, 10, |lua, key| {
|
||||
match key {
|
||||
b"image_alloc" => lua.to_value_with(&TASKS.image_alloc, OPTS)?,
|
||||
_ => return Ok(Value::Nil),
|
||||
}
|
||||
.into_lua(lua)
|
||||
})
|
||||
}
|
||||
|
||||
pub fn new(lua: &'a Lua) -> Self { Self { lua } }
|
||||
|
||||
// TODO: remove this
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue