From 7f339381f1518690751b10c2d7484baf31045e5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E5=92=B2=E9=9B=85=20misaki=20masa?= Date: Mon, 16 Feb 2026 21:42:36 +0800 Subject: [PATCH] feat: new `marker_symbol` option to specify the symbol used for marking files (#3689) --- CHANGELOG.md | 2 ++ yazi-config/preset/theme-dark.toml | 1 + yazi-config/preset/theme-light.toml | 1 + yazi-config/src/theme/theme.rs | 1 + yazi-plugin/preset/components/marker.lua | 2 +- yazi-plugin/preset/components/tab.lua | 9 +++++---- yazi-plugin/src/theme/theme.rs | 1 + 7 files changed, 12 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e66c785..1fb14358 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/): - New `fs.access()` API to access the filesystem ([#3668]) - New `relay-notify-push` DDS event to customize the notification handler ([#3642]) - New `ind-app-title` DDS event to customize the app title ([#3684]) +- New `marker_symbol` option to specify the symbol used for marking files ([#3689]) - New `fs.unique()` creates a unique file or directory ([#3677]) - New `download` DDS event fires when remote files are downloaded ([#3687]) - New `cx.which` API to access the which component state ([#3617]) @@ -1662,3 +1663,4 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/): [#3678]: https://github.com/sxyazi/yazi/pull/3678 [#3684]: https://github.com/sxyazi/yazi/pull/3684 [#3687]: https://github.com/sxyazi/yazi/pull/3687 +[#3689]: https://github.com/sxyazi/yazi/pull/3689 diff --git a/yazi-config/preset/theme-dark.toml b/yazi-config/preset/theme-dark.toml index d8b4365d..1d36e9d0 100644 --- a/yazi-config/preset/theme-dark.toml +++ b/yazi-config/preset/theme-dark.toml @@ -41,6 +41,7 @@ marker_copied = { fg = "lightgreen", bg = "lightgreen" } marker_cut = { fg = "lightred", bg = "lightred" } marker_marked = { fg = "lightcyan", bg = "lightcyan" } marker_selected = { fg = "lightyellow", bg = "lightyellow" } +marker_symbol = "│" # Count count_copied = { fg = "white", bg = "green" } diff --git a/yazi-config/preset/theme-light.toml b/yazi-config/preset/theme-light.toml index f23cb85c..0489b216 100644 --- a/yazi-config/preset/theme-light.toml +++ b/yazi-config/preset/theme-light.toml @@ -41,6 +41,7 @@ marker_copied = { fg = "lightgreen", bg = "lightgreen" } marker_cut = { fg = "lightred", bg = "lightred" } marker_marked = { fg = "lightcyan", bg = "lightcyan" } marker_selected = { fg = "lightyellow", bg = "lightyellow" } +marker_symbol = "│" # Count count_copied = { fg = "white", bg = "green" } diff --git a/yazi-config/src/theme/theme.rs b/yazi-config/src/theme/theme.rs index 57eb2a46..516ae991 100644 --- a/yazi-config/src/theme/theme.rs +++ b/yazi-config/src/theme/theme.rs @@ -55,6 +55,7 @@ pub struct Mgr { pub marker_cut: Style, pub marker_marked: Style, pub marker_selected: Style, + pub marker_symbol: String, // Count pub count_copied: Style, diff --git a/yazi-plugin/preset/components/marker.lua b/yazi-plugin/preset/components/marker.lua index 00bd31a9..19ccd8d7 100644 --- a/yazi-plugin/preset/components/marker.lua +++ b/yazi-plugin/preset/components/marker.lua @@ -29,7 +29,7 @@ function Marker:redraw() w = 1, h = math.min(1 + last[2] - last[1], self._area.y + self._area.h - y), } - elements[#elements + 1] = ui.Bar(ui.Edge.LEFT):area(rect):style(last[3]) + elements[#elements + 1] = ui.Bar(ui.Edge.LEFT):area(rect):style(last[3]):symbol(th.mgr.marker_symbol) end local last = { 0, 0, nil } -- start, end, style diff --git a/yazi-plugin/preset/components/tab.lua b/yazi-plugin/preset/components/tab.lua index 6dbd1ca0..58d06747 100644 --- a/yazi-plugin/preset/components/tab.lua +++ b/yazi-plugin/preset/components/tab.lua @@ -22,11 +22,12 @@ function Tab:layout() end function Tab:build() + local c = self._chunks self._children = { - Parent:new(self._chunks[1]:pad(ui.Pad.x(1)), self._tab), - Current:new(self._chunks[2], self._tab), - Preview:new(self._chunks[3]:pad(ui.Pad.x(1)), self._tab), - Rail:new(self._chunks, self._tab), + Parent:new(c[1]:pad(ui.Pad.x(1)), self._tab), + Current:new(c[2]:pad(ui.Pad(0, c[3].w > 0 and 0 or 1, 0, c[1].w > 0 and 0 or 1)), self._tab), + Preview:new(c[3]:pad(ui.Pad.x(1)), self._tab), + Rail:new(c, self._tab), } end diff --git a/yazi-plugin/src/theme/theme.rs b/yazi-plugin/src/theme/theme.rs index 2a8489c4..c055682e 100644 --- a/yazi-plugin/src/theme/theme.rs +++ b/yazi-plugin/src/theme/theme.rs @@ -60,6 +60,7 @@ fn mgr() -> Composer { b"marker_cut" => Style::from(m.marker_cut).into_lua(lua), b"marker_marked" => Style::from(m.marker_marked).into_lua(lua), b"marker_selected" => Style::from(m.marker_selected).into_lua(lua), + b"marker_symbol" => lua.create_string(&m.marker_symbol)?.into_lua(lua), b"count_copied" => Style::from(m.count_copied).into_lua(lua), b"count_cut" => Style::from(m.count_cut).into_lua(lua),