Skip to content

Commit 7e3c0be

Browse files
feat: renderer.full_name includes root node (#2502)
* Do not exclude root node from `full_name` * fix range --------- Co-authored-by: Alexander Courtis <alex@courtis.org>
1 parent 7630cf4 commit 7e3c0be

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

lua/nvim-tree/renderer/components/full-name.lua

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@ end
3434

3535
local function show()
3636
local line_nr = vim.api.nvim_win_get_cursor(0)[1]
37-
if line_nr == 1 and require("nvim-tree.view").is_root_folder_visible() then
38-
return
39-
end
4037
if vim.wo.wrap then
4138
return
4239
end
@@ -60,8 +57,9 @@ local function show()
6057
end
6158

6259
M.popup_win = vim.api.nvim_open_win(vim.api.nvim_create_buf(false, false), false, {
63-
relative = "win",
64-
bufpos = { vim.fn.line "." - 2, 0 },
60+
relative = "cursor",
61+
row = 0,
62+
col = 1 - vim.fn.getcursorcharpos()[3],
6563
width = math.min(text_width, vim.o.columns - 2),
6664
height = 1,
6765
noautocmd = true,
@@ -71,7 +69,7 @@ local function show()
7169
local ns_id = vim.api.nvim_get_namespaces()["NvimTreeHighlights"]
7270
local extmarks = vim.api.nvim_buf_get_extmarks(0, ns_id, { line_nr - 1, 0 }, { line_nr - 1, -1 }, { details = 1 })
7371
vim.api.nvim_win_call(M.popup_win, function()
74-
vim.fn.setbufline("%", 1, line)
72+
vim.api.nvim_buf_set_lines(0, 0, -1, true, { line })
7573
for _, extmark in ipairs(extmarks) do
7674
local hl = extmark[4]
7775
vim.api.nvim_buf_add_highlight(0, ns_id, hl.hl_group, 0, extmark[3], hl.end_col)

0 commit comments

Comments
 (0)