fix(popup): correct width calculation #418
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem: In the case where
numberandrelativenumberare not set, the width is too small, because it does not account for the length of the line number that is shown for the popup. Previously, we addedstrlen(line('$'))to the width, which is incorrect whennumberandrelativenumberare set.Solution: set the floating window options first, then set the width and height. In the case of no
relativenumber(whena:text_methodis 0), jump to the floating window and calculatewincol()andvirtcol('.')there, then jump back to the current window. The jump is done without triggering autocommands (so no redraw is done and the user notices nothing).