mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-24 16:21:04 +00:00
fix: reversed style shouldn't be applied to the entire text block
This commit is contained in:
parent
2a4a398342
commit
d754ac5dac
3 changed files with 13 additions and 12 deletions
|
|
@ -6,12 +6,11 @@ function M:peek(job)
|
|||
|
||||
local files, bound, code = self.list_files({ "-p", tostring(job.file.url) }, job.skip, limit)
|
||||
if code ~= 0 then
|
||||
return ya.preview_widgets(job, {
|
||||
ui.Text(
|
||||
code == 2 and "File list in this archive is encrypted"
|
||||
or "Failed to start both `7z` and `7zz`. Do you have 7-zip installed?"
|
||||
):area(job.area),
|
||||
})
|
||||
return require("empty").msg(
|
||||
job,
|
||||
code == 2 and "File list in this archive is encrypted"
|
||||
or "Failed to start both `7z` and `7zz`. Do you have 7-zip installed?"
|
||||
)
|
||||
end
|
||||
|
||||
for _, f in ipairs(files) do
|
||||
|
|
|
|||
|
|
@ -5,9 +5,7 @@ function M:peek(job)
|
|||
if bound then
|
||||
ya.manager_emit("peek", { bound, only_if = job.file.url, upper_bound = true })
|
||||
elseif err and not err:find("cancelled", 1, true) then
|
||||
ya.preview_widgets(job, {
|
||||
ui.Text(err):area(job.area):reverse(),
|
||||
})
|
||||
require("empty").msg(job, err)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,15 @@
|
|||
local M = {}
|
||||
|
||||
function M:msg(job, s) ya.preview_widgets(job, { ui.Text(s):area(job.area):reverse():wrap(ui.Text.WRAP) }) end
|
||||
function M.msg(job, s)
|
||||
ya.preview_widgets(job, {
|
||||
ui.Text(ui.Line(s):reverse()):area(job.area):wrap(ui.Text.WRAP),
|
||||
})
|
||||
end
|
||||
|
||||
function M:peek(job)
|
||||
local path = tostring(job.file.url)
|
||||
if path:sub(1, 6) ~= "/proc/" then
|
||||
return self:msg(job, "Empty file")
|
||||
return self.msg(job, "Empty file")
|
||||
end
|
||||
|
||||
local limit = job.area.h
|
||||
|
|
@ -22,7 +26,7 @@ function M:peek(job)
|
|||
end)
|
||||
|
||||
if not ok then
|
||||
self:msg(job, err)
|
||||
self.msg(job, err)
|
||||
elseif job.skip > 0 and i < job.skip + limit then
|
||||
ya.manager_emit("peek", { math.max(0, i - limit), only_if = job.file.url, upper_bound = true })
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue