Skip to content

Commit fdca4e7

Browse files
committed
add 'bottom' char for a corner extension
1 parent 8b390da commit fdca4e7

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed

doc/nvim-tree-lua.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ Subsequent calls to setup will replace the previous configuration.
221221
corner = "└",
222222
edge = "│",
223223
item = "│",
224+
bottom = "─",
224225
none = " ",
225226
},
226227
},
@@ -728,7 +729,7 @@ UI rendering setup
728729

729730
*nvim-tree.renderer.indent_markers.icons*
730731
Icons shown before the file/directory.
731-
Type: `table`, Default: `{ corner = "└", edge = "│", item = "│", none = " ", }`
732+
Type: `table`, Default: `{ corner = "└", edge = "│", item = "│", bottom = "─", none = " ", }`
732733

733734
*nvim-tree.renderer.icons*
734735
Configuration options for icons.

lua/nvim-tree.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,7 @@ local DEFAULT_OPTS = { -- BEGIN_DEFAULT_OPTS
484484
corner = "",
485485
edge = "",
486486
item = "",
487+
bottom = "",
487488
none = " ",
488489
},
489490
},

lua/nvim-tree/renderer/components/padding.lua

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,25 +30,27 @@ local function get_padding_indent_markers(depth, idx, nodes_number, markers, wit
3030
for i = 1, depth do
3131
local glyph
3232
if idx == nodes_number and i == depth then
33-
glyph = M.config.indent_markers.icons.corner
33+
local bottom_width = M.config.indent_width - 2 +
34+
(with_arrows and not inline_arrows and has_folder_sibling and 2 or 0)
35+
glyph = M.config.indent_markers.icons.corner ..
36+
string.rep(M.config.indent_markers.icons.bottom, bottom_width) ..
37+
(M.config.indent_width > 1 and " " or "")
3438
elseif markers[i] and i == depth then
35-
glyph = M.config.indent_markers.icons.item
39+
glyph = M.config.indent_markers.icons.item .. indent
3640
elseif markers[i] then
37-
glyph = M.config.indent_markers.icons.edge
41+
glyph = M.config.indent_markers.icons.edge .. indent
3842
else
39-
glyph = M.config.indent_markers.icons.none
43+
glyph = M.config.indent_markers.icons.none .. indent
4044
end
4145

4246
if not with_arrows or (inline_arrows and (depth ~= i or not node.nodes)) then
43-
padding = padding .. glyph .. indent
47+
padding = padding .. glyph
4448
elseif inline_arrows then
4549
padding = padding
46-
elseif idx == nodes_number and i == depth and has_folder_sibling then
47-
padding = padding .. base_padding .. glyph .. "──" .. indent
48-
elseif depth == i and not node.nodes and has_folder_sibling then
49-
padding = padding .. base_padding .. glyph .. indent .. base_padding
50+
elseif idx ~= nodes_number and depth == i and not node.nodes and has_folder_sibling then
51+
padding = padding .. base_padding .. glyph .. base_padding
5052
else
51-
padding = padding .. base_padding .. glyph .. indent
53+
padding = padding .. base_padding .. glyph
5254
end
5355
end
5456
end

0 commit comments

Comments
 (0)