Skip to content

Commit ab65e77

Browse files
committed
fix(renderer): force tree components to be one line, fixes #108
1 parent d1d24b1 commit ab65e77

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

lua/neo-tree/ui/renderer.lua

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,14 @@ create_nodes = function(source_items, state, level)
113113
return nodes
114114
end
115115

116+
local one_line = function(text)
117+
if type(text) == "string" then
118+
return text:gsub("\n", " ")
119+
else
120+
return text
121+
end
122+
end
123+
116124
local prepare_node = function(item, state)
117125
local line = NuiLine()
118126
line:append(item.indent)
@@ -130,10 +138,10 @@ local prepare_node = function(item, state)
130138
if component_data[1] then
131139
-- a list of text objects
132140
for _, data in ipairs(component_data) do
133-
line:append(data.text, data.highlight)
141+
line:append(one_line(data.text), data.highlight)
134142
end
135143
else
136-
line:append(component_data.text, component_data.highlight)
144+
line:append(one_line(component_data.text), component_data.highlight)
137145
end
138146
else
139147
local name = component[1] or "[missing_name]"

0 commit comments

Comments
 (0)