@@ -18,6 +18,13 @@ local log = require("neo-tree.log")
18
18
19
19
local M = {}
20
20
21
+ local make_two_char = function (symbol )
22
+ if vim .fn .strchars (symbol ) == 1 then
23
+ return symbol .. " "
24
+ else
25
+ return symbol
26
+ end
27
+ end
21
28
-- only works in the buffers component, but it's here so we don't have to defined
22
29
-- multple renderers.
23
30
M .bufnr = function (config , node , state )
@@ -90,17 +97,13 @@ M.diagnostics = function(config, node, state)
90
97
end
91
98
defined = defined and defined [1 ]
92
99
if defined and defined .text and defined .texthl then
93
- -- for some reason it always comes padded with a space
94
- if type (defined .text ) == " string" and defined .text :sub (# defined .text ) == " " then
95
- defined .text = defined .text :sub (1 , - 2 )
96
- end
97
100
return {
98
- text = " " .. defined .text ,
101
+ text = make_two_char ( defined .text ) ,
99
102
highlight = defined .texthl ,
100
103
}
101
104
else
102
105
return {
103
- text = " " .. severity :sub (1 , 1 ),
106
+ text = severity :sub (1 , 1 ) .. " " ,
104
107
highlight = " Diagnostic" .. severity ,
105
108
}
106
109
end
@@ -184,20 +187,20 @@ M.git_status = function(config, node, state)
184
187
local components = {}
185
188
if type (change_symbol ) == " string" and # change_symbol > 0 then
186
189
table.insert (components , {
187
- text = " " .. change_symbol ,
190
+ text = make_two_char ( change_symbol ) ,
188
191
highlight = change_highlt ,
189
192
})
190
193
end
191
194
if type (status_symbol ) == " string" and # status_symbol > 0 then
192
195
table.insert (components , {
193
- text = " " .. status_symbol ,
196
+ text = make_two_char ( status_symbol ) ,
194
197
highlight = status_highlt ,
195
198
})
196
199
end
197
200
return components
198
201
else
199
202
return {
200
- text = " [" .. git_status .. " ]" ,
203
+ text = " [" .. git_status .. " ]" ,
201
204
highlight = config .highlight or change_highlt ,
202
205
}
203
206
end
@@ -208,27 +211,27 @@ M.filtered_by = function(config, node, state)
208
211
local fby = node .filtered_by
209
212
if fby .name then
210
213
return {
211
- text = " (hide by name)" ,
214
+ text = " (hide by name) " ,
212
215
highlight = highlights .HIDDEN_BY_NAME ,
213
216
}
214
217
elseif fby .pattern then
215
218
return {
216
- text = " (hide by pattern)" ,
219
+ text = " (hide by pattern) " ,
217
220
highlight = highlights .HIDDEN_BY_NAME ,
218
221
}
219
222
elseif fby .gitignored then
220
223
return {
221
- text = " (gitignored)" ,
224
+ text = " (gitignored) " ,
222
225
highlight = highlights .GIT_IGNORED ,
223
226
}
224
227
elseif fby .dotfiles then
225
228
return {
226
- text = " (dotfile)" ,
229
+ text = " (dotfile) " ,
227
230
highlight = highlights .DOTFILE ,
228
231
}
229
232
elseif fby .hidden then
230
233
return {
231
- text = " (hidden)" ,
234
+ text = " (hidden) " ,
232
235
highlight = highlights .WINDOWS_HIDDEN ,
233
236
}
234
237
end
@@ -269,7 +272,7 @@ M.modified = function(config, node, state)
269
272
local modified_buffers = state .modified_buffers or {}
270
273
if modified_buffers [node .path ] then
271
274
return {
272
- text = " " .. (config .symbol or " [+]" ),
275
+ text = (config .symbol or " [+] " ),
273
276
highlight = config .highlight or highlights .MODIFIED ,
274
277
}
275
278
else
@@ -301,7 +304,7 @@ M.name = function(config, node, state)
301
304
end
302
305
303
306
return {
304
- text = text ,
307
+ text = text .. " " ,
305
308
highlight = highlight ,
306
309
}
307
310
end
0 commit comments