Skip to content

feat(full_name): do not exclude root node #2502

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 30, 2023

Conversation

przepompownia
Copy link
Contributor

No description provided.

@przepompownia
Copy link
Contributor Author

What do you think about including the parent node to full_name?

image
image
image

@przepompownia przepompownia changed the title Do not exclude root node from full_name feat(full_name)Do not exclude root node Oct 30, 2023
@przepompownia przepompownia changed the title feat(full_name)Do not exclude root node feat(full_name): do not exclude root node Oct 30, 2023
@przepompownia przepompownia marked this pull request as ready for review October 30, 2023 01:20
Copy link
Member

@alex-courtis alex-courtis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch; this has been broken a long time, possibly forever.

We don't see the window when the tree buffer is scrolled horizontally, however that's existing behaviour and not really a sensible use case.

20231030_131400

bufpos = { vim.fn.line "." - 2, 0 },
relative = "cursor",
row = 0,
col = 1 - vim.fn.getcursorcharpos()[3],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a more sensible way to achieve positioning.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vim.wo.number = true
vim.api.nvim_buf_set_lines(0, 0, 1, true, {'', '', ''})
vim.bo[0].buftype = 'nofile'

local buf = vim.api.nvim_create_buf(false, true)
vim.api.nvim_buf_set_lines(buf, 0, 0, true, {'>---------------->'})
vim.bo[buf].buftype = 'nofile'

local winId = nil

local function test()
  if winId then
    vim.api.nvim_win_close(winId, true)
  end
  local bufline = vim.api.nvim_win_get_cursor(0)[1]
  print(bufline)
  local winConfig = {
    relative = 'win',
    width = 50,
    height = 1,
    style = 'minimal',
    bufpos = { 1, 0 },
  }
  winId = vim.api.nvim_open_win(buf, false, winConfig)
end

test()
vim.api.nvim_create_autocmd('CursorMoved', {callback = test})

Initially I tried relative = 'win' but never didn't able to cover the the first line. I then switched to try cursor.

@alex-courtis alex-courtis merged commit 7e3c0be into nvim-tree:master Oct 30, 2023
@przepompownia przepompownia deleted the full-named-root-node branch October 30, 2023 07:00
@przepompownia
Copy link
Contributor Author

Thanks for merging. I hope it works also on cases not used usually by me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants