From b9416d8a041849b0bc8d5790e9934b8b5a762a80 Mon Sep 17 00:00:00 2001 From: boydaihungst <38396158+boydaihungst@users.noreply.github.com> Date: Fri, 14 Feb 2025 22:08:40 +0700 Subject: [PATCH] feat: respect the user's `wrap` setting for the built-in JSON previewer (#2337) --- yazi-plugin/preset/plugins/json.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/yazi-plugin/preset/plugins/json.lua b/yazi-plugin/preset/plugins/json.lua index 9ecee22b..d4a5d491 100644 --- a/yazi-plugin/preset/plugins/json.lua +++ b/yazi-plugin/preset/plugins/json.lua @@ -32,7 +32,10 @@ function M:peek(job) ya.manager_emit("peek", { math.max(0, i - limit), only_if = job.file.url, upper_bound = true }) else lines = lines:gsub("\t", string.rep(" ", PREVIEW.tab_size)) - ya.preview_widgets(job, { ui.Text.parse(lines):area(job.area) }) + ya.preview_widgets( + job, + { ui.Text.parse(lines):area(job.area):wrap(PREVIEW.wrap == "Yes" and ui.Text.WRAP or ui.Text.WRAP_NO) } + ) end end