-
-
Notifications
You must be signed in to change notification settings - Fork 638
fix: live filter overlay width calculation #2524
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
fix: live filter overlay width calculation #2524
Conversation
|
I think this approach with using |
ebc4fd2 to
8b3ccb8
Compare
8b3ccb8 to
24b5404
Compare
|
|
||
| local function create_overlay() | ||
| local function calculate_overlay_win_width() | ||
| local wininfo = vim.fn.getwininfo(view.get_winnr())[1] |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this 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.
- Please simplify: #2524 (comment)
alex-courtis
left a comment
There was a problem hiding this 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] |
There was a problem hiding this comment.
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.
Closes #2523