34
34
35
35
local function show ()
36
36
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
40
37
if vim .wo .wrap then
41
38
return
42
39
end
@@ -60,8 +57,9 @@ local function show()
60
57
end
61
58
62
59
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 ],
65
63
width = math.min (text_width , vim .o .columns - 2 ),
66
64
height = 1 ,
67
65
noautocmd = true ,
@@ -71,7 +69,7 @@ local function show()
71
69
local ns_id = vim .api .nvim_get_namespaces ()[" NvimTreeHighlights" ]
72
70
local extmarks = vim .api .nvim_buf_get_extmarks (0 , ns_id , { line_nr - 1 , 0 }, { line_nr - 1 , - 1 }, { details = 1 })
73
71
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 } )
75
73
for _ , extmark in ipairs (extmarks ) do
76
74
local hl = extmark [4 ]
77
75
vim .api .nvim_buf_add_highlight (0 , ns_id , hl .hl_group , 0 , extmark [3 ], hl .end_col )
0 commit comments