Skip to content

Conversation

@moreka
Copy link
Contributor

@moreka moreka commented Oct 17, 2025

Problem: In the case where number and relativenumber are 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 added strlen(line('$')) to the width, which is incorrect when number and relativenumber are set.

Solution: set the floating window options first, then set the width and height. In the case of no relativenumber (when a:text_method is 0), jump to the floating window and calculate wincol() and virtcol('.') 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).

    Problem: In the case where `number` and `relativenumber` are 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 added `strlen(line('$'))` to the width, which is incorrect when
    `number` and `relativenumber` are set.

    Solution: set the floating window options first, then set the width
    and height. In the case of no `relativenumber` (when `a:text_method`
    is 0), jump to the floating window and calculate `wincol()` and
    `virtcol('.')` 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).
@moreka moreka marked this pull request as draft October 17, 2025 16:47
@moreka
Copy link
Contributor Author

moreka commented Oct 17, 2025

Apparently there is an issue with the trick I used (jumping to the float window and coming back) when you have splits open. I have to investigate this.

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.

1 participant