Skip to content

Conversation

@geril07
Copy link
Collaborator

@geril07 geril07 commented Nov 9, 2023

Closes #2523

@geril07
Copy link
Collaborator Author

geril07 commented Nov 9, 2023

I think this approach with using textoff(calculates width of signcolumn etc before the buffer content) the easiest way to calculate width.

@geril07 geril07 force-pushed the fix/live-filter-overlay-width branch 3 times, most recently from ebc4fd2 to 8b3ccb8 Compare November 9, 2023 14:56
@geril07 geril07 force-pushed the fix/live-filter-overlay-width branch from 8b3ccb8 to 24b5404 Compare November 10, 2023 12:00

local function create_overlay()
local function calculate_overlay_win_width()
local wininfo = vim.fn.getwininfo(view.get_winnr())[1]
Copy link
Member

@alex-courtis alex-courtis Nov 12, 2023

Choose a reason for hiding this comment

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

getwininfo is hardened against nil winid.

I'm not sure how we'd get a nil however thank you for your defensive programming.

Simly returning 20 would be enough; subtracting 2 doesn't really do much.

Copy link
Collaborator Author

@geril07 geril07 Nov 12, 2023

Choose a reason for hiding this comment

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

By doc it could be nil, maybe 1 time in 1 million and if it happens we can secure by simply return 20. I don't think it reduces the readability of the code.

Copy link
Member

Choose a reason for hiding this comment

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

By doc it could be nil, maybe 1 time in 1 million and if it happens we can secure by simply return 20. I don't think it reduces the readability of the code.

Yup, that's the safest and most resilient solution.

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.

Many thanks for all the fantastic contributions you've made recently - quality is greatly improving!

OK:

  • defaults
  • view.relativenumber = true
  • view.signcolumn = "no"
  • view.float.enable = true

P.S. You're a repo member and can push your branches directly.

@geril07 geril07 requested a review from alex-courtis November 12, 2023 14: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.

Many thanks for your contrubution.


local function create_overlay()
local function calculate_overlay_win_width()
local wininfo = vim.fn.getwininfo(view.get_winnr())[1]
Copy link
Member

Choose a reason for hiding this comment

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

By doc it could be nil, maybe 1 time in 1 million and if it happens we can secure by simply return 20. I don't think it reduces the readability of the code.

Yup, that's the safest and most resilient solution.

@alex-courtis alex-courtis merged commit 80cfead into nvim-tree:master Nov 12, 2023
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.

Live filter window exceeds window limit with relativenumber

2 participants