Skip to content

Commit b264068

Browse files
committed
Revert "feat(#2349): add "right_align" option for renderer.icons.*_placement (#2839)"
This reverts commit 1d629a5.
1 parent 1d629a5 commit b264068

File tree

6 files changed

+18
-46
lines changed

6 files changed

+18
-46
lines changed

doc/nvim-tree-lua.txt

+12-10
Original file line numberDiff line numberDiff line change
@@ -944,12 +944,6 @@ Configuration options for icons.
944944
Icon order and sign column precedence:
945945
git < modified < bookmarked < diagnostics
946946

947-
`renderer.icons.*_placement` options may be:
948-
- `"before"` : before file/folder, after the file/folders icons
949-
- `"after"` : after file/folder
950-
- `"signcolumn"` : far left, requires |nvim-tree.view.signcolumn| enabled
951-
- `"right_align"` : far right
952-
953947
*nvim-tree.renderer.icons.web_devicons*
954948
Configure optional plugin `"nvim-tree/nvim-web-devicons"`
955949

@@ -978,19 +972,27 @@ Icon order and sign column precedence:
978972
Type: `boolean`, Default: `true`
979973

980974
*nvim-tree.renderer.icons.git_placement*
981-
Git icons placement.
975+
Place where the git icons will be rendered.
976+
Can be `"after"` or `"before"` filename (after the file/folders icons)
977+
or `"signcolumn"` (requires |nvim-tree.view.signcolumn| enabled).
982978
Type: `string`, Default: `"before"`
983979

984980
*nvim-tree.renderer.icons.diagnostics_placement*
985-
Diganostic icon placement.
981+
Place where the diagnostics icon will be rendered.
982+
Can be `"after"` or `"before"` filename (after the file/folders icons)
983+
or `"signcolumn"` (requires |nvim-tree.view.signcolumn| enabled).
986984
Type: `string`, Default: `"signcolumn"`
987985

988986
*nvim-tree.renderer.icons.modified_placement*
989-
Modified icon placement.
987+
Place where the modified icon will be rendered.
988+
Can be `"after"` or `"before"` filename (after the file/folders icons)
989+
or `"signcolumn"` (requires |nvim-tree.view.signcolumn| enabled).
990990
Type: `string`, Default: `"after"`
991991

992992
*nvim-tree.renderer.icons.bookmarks_placement*
993-
Bookmark icon placement.
993+
Place where the bookmarks icon will be rendered.
994+
Can be `"after"` or `"before"` filename (after the file/folders icons)
995+
or `"signcolumn"` (requires |nvim-tree.view.signcolumn| enabled).
994996
Type: `string`, Default: `signcolumn`
995997

996998
*nvim-tree.renderer.icons.padding*

lua/nvim-tree.lua

+4-4
Original file line numberDiff line numberDiff line change
@@ -672,10 +672,10 @@ local ACCEPTED_STRINGS = {
672672
highlight_diagnostics = { "none", "icon", "name", "all" },
673673
highlight_clipboard = { "none", "icon", "name", "all" },
674674
icons = {
675-
git_placement = { "before", "after", "signcolumn", "right_align" },
676-
modified_placement = { "before", "after", "signcolumn", "right_align" },
677-
diagnostics_placement = { "before", "after", "signcolumn", "right_align" },
678-
bookmarks_placement = { "before", "after", "signcolumn", "right_align" },
675+
git_placement = { "before", "after", "signcolumn" },
676+
modified_placement = { "before", "after", "signcolumn" },
677+
diagnostics_placement = { "before", "after", "signcolumn" },
678+
bookmarks_placement = { "before", "after", "signcolumn" },
679679
},
680680
},
681681
help = {

lua/nvim-tree/enum.lua

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ M.ICON_PLACEMENT = {
1616
signcolumn = 1,
1717
before = 2,
1818
after = 3,
19-
right_align = 4,
2019
}
2120

2221
return M

lua/nvim-tree/renderer/builder.lua

-9
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ function Builder:new()
6060
lines = {},
6161
markers = {},
6262
signs = {},
63-
extmarks = {},
6463
}
6564
setmetatable(o, self)
6665
self.__index = self
@@ -229,14 +228,6 @@ function Builder:format_line(indent_markers, arrows, icon, name, node)
229228
add_to_end(line, M.decorators[i]:icons_after(node))
230229
end
231230

232-
local rights = {}
233-
for i = #M.decorators, 1, -1 do
234-
add_to_end(rights, M.decorators[i]:icons_right_align(node))
235-
end
236-
if #rights > 0 then
237-
self.extmarks[self.index] = rights
238-
end
239-
240231
return line
241232
end
242233

lua/nvim-tree/renderer/decorator/init.lua

-11
Original file line numberDiff line numberDiff line change
@@ -74,17 +74,6 @@ function Decorator:icons_after(node)
7474
return self:calculate_icons(node)
7575
end
7676

77-
---Icons when ICON_PLACEMENT.right_align
78-
---@param node Node
79-
---@return HighlightedString[]|nil icons
80-
function Decorator:icons_right_align(node)
81-
if not self.enabled or self.icon_placement ~= ICON_PLACEMENT.right_align then
82-
return
83-
end
84-
85-
return self:calculate_icons(node)
86-
end
87-
8877
---Maybe icons, optionally implemented
8978
---@protected
9079
---@param _ Node

lua/nvim-tree/renderer/init.lua

+2-11
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ local namespace_id = vim.api.nvim_create_namespace "NvimTreeHighlights"
1818
---@param lines string[]
1919
---@param hl_args AddHighlightArgs[]
2020
---@param signs string[]
21-
local function _draw(bufnr, lines, hl_args, signs, extmarks)
21+
local function _draw(bufnr, lines, hl_args, signs)
2222
if vim.fn.has "nvim-0.10" == 1 then
2323
vim.api.nvim_set_option_value("modifiable", true, { buf = bufnr })
2424
else
@@ -38,15 +38,6 @@ local function _draw(bufnr, lines, hl_args, signs, extmarks)
3838
for i, sign_name in pairs(signs) do
3939
vim.fn.sign_place(0, SIGN_GROUP, sign_name, bufnr, { lnum = i + 1 })
4040
end
41-
for i, extname in pairs(extmarks) do
42-
for _, mark in ipairs(extname) do
43-
vim.api.nvim_buf_set_extmark(bufnr, namespace_id, i, -1, {
44-
virt_text = { { mark.str, mark.hl } },
45-
virt_text_pos = "right_align",
46-
hl_mode = "combine",
47-
})
48-
end
49-
end
5041
end
5142

5243
function M.render_hl(bufnr, hl)
@@ -76,7 +67,7 @@ function M.draw()
7667

7768
local builder = Builder:new():build()
7869

79-
_draw(bufnr, builder.lines, builder.hl_args, builder.signs, builder.extmarks)
70+
_draw(bufnr, builder.lines, builder.hl_args, builder.signs)
8071

8172
if cursor and #builder.lines >= cursor[1] then
8273
vim.api.nvim_win_set_cursor(view.get_winnr() or 0, cursor)

0 commit comments

Comments
 (0)