@@ -88,28 +88,22 @@ if icon_state.show_git_icon then
88
88
end
89
89
90
90
local get_padding = function (depth )
91
- return string.rep (' ' , depth ), 0
91
+ return string.rep (' ' , depth )
92
92
end
93
93
94
- local add_padding_glyph = true
95
94
if vim .g .lua_tree_indent_markers == 1 then
96
95
get_padding = function (depth , idx , tree , node )
97
96
local padding = " "
98
- local offset = 0
99
97
if depth ~= 0 then
100
- padding = string.rep (" " , depth - 2 )
101
- if add_padding_glyph and (idx == # tree .entries or node .open ) then
102
- padding = padding .. ' └ '
103
- offset = string.len (' └ ' ) - 2
104
- add_padding_glyph = false
105
- elseif add_padding_glyph then
106
- padding = padding .. ' │ '
107
- offset = string.len (' │ ' ) - 2
108
- else
109
- padding = padding .. ' '
98
+ for i = 1 ,depth / 2 do
99
+ if idx == # tree .entries and i == depth / 2 then
100
+ padding = padding .. ' └ '
101
+ else
102
+ padding = padding .. ' │ '
103
+ end
110
104
end
111
105
end
112
- return padding , offset
106
+ return padding
113
107
end
114
108
end
115
109
@@ -134,13 +128,16 @@ local function update_draw_data(tree, depth)
134
128
index = 1
135
129
end
136
130
137
- add_padding_glyph = true
138
131
for idx , node in ipairs (tree .entries ) do
139
- local padding , offset = get_padding (depth , idx , tree , node , add_padding_glyph )
132
+ local padding = get_padding (depth , idx , tree , node )
133
+ local offset = string.len (padding )
134
+ if depth > 0 then
135
+ table.insert (hl , { ' LuaTreeIndentMarker' , index , 0 , offset })
136
+ end
140
137
if node .entries then
141
138
local icon = get_folder_icon (node .open )
142
- local git_icon = get_git_icons (node , index , depth + offset +# node .name , # icon + 1 )
143
- set_folder_hl (index , depth + offset , # icon , # node .name )
139
+ local git_icon = get_git_icons (node , index , offset +# node .name , # icon + 1 )
140
+ set_folder_hl (index , offset , # icon , # node .name )
144
141
index = index + 1
145
142
if node .open then
146
143
table.insert (lines , padding .. icon .. node .name .. " " .. git_icon )
@@ -149,7 +146,7 @@ local function update_draw_data(tree, depth)
149
146
table.insert (lines , padding .. icon .. node .name .. " " .. git_icon )
150
147
end
151
148
elseif node .link_to then
152
- table.insert (hl , { ' LuaTreeSymlink' , index , depth + offset , - 1 })
149
+ table.insert (hl , { ' LuaTreeSymlink' , index , offset , - 1 })
153
150
table.insert (lines , padding .. node .name .. " ➛ " .. node .link_to )
154
151
index = index + 1
155
152
@@ -158,17 +155,17 @@ local function update_draw_data(tree, depth)
158
155
local git_icons
159
156
if special [node .name ] then
160
157
icon = " "
161
- git_icons = get_git_icons (node , index , depth + offset , 0 )
162
- table.insert (hl , {' LuaTreeSpecialFile' , index , depth + offset +# git_icons , - 1 })
158
+ git_icons = get_git_icons (node , index , offset , 0 )
159
+ table.insert (hl , {' LuaTreeSpecialFile' , index , offset +# git_icons , - 1 })
163
160
else
164
- icon = get_file_icon (node .name , node .extension , index , depth + offset )
165
- git_icons = get_git_icons (node , index , depth + offset , # icon )
161
+ icon = get_file_icon (node .name , node .extension , index , offset )
162
+ git_icons = get_git_icons (node , index , offset , # icon )
166
163
end
167
164
table.insert (lines , padding .. icon .. git_icons .. node .name )
168
165
if node .executable then
169
- table.insert (hl , {' LuaTreeExecFile' , index , depth + offset +# icon +# git_icons , - 1 })
166
+ table.insert (hl , {' LuaTreeExecFile' , index , offset +# icon +# git_icons , - 1 })
170
167
elseif picture [node .extension ] then
171
- table.insert (hl , {' LuaTreeImageFile' , index , depth + offset +# icon +# git_icons , - 1 })
168
+ table.insert (hl , {' LuaTreeImageFile' , index , offset +# icon +# git_icons , - 1 })
172
169
end
173
170
index = index + 1
174
171
end
0 commit comments