filipdutescu / renamer.nvim

VS Code-like renaming UI for Neovim, writen in Lua.
Apache License 2.0
298 stars 11 forks source link

[Bug] Bad popup rendering when renaming on first or second line #105

Closed xeluxee closed 2 years ago

xeluxee commented 2 years ago

Describe the bug

This doesn't happen every time, and it seems to depend on the code.

  1. Try a code like this with sumneko_lua
    local func = require("func")
    return func.sum(1, 2)
  2. Rename func with cursor on first line
  3. You'll see the popup is cropped p1
  4. Rename func with cursor on second line
  5. You'll see popup title is substituted by popup content p2

Note: what you see above first line is barbar.nvim

Environment

filipdutescu commented 2 years ago

Did you manage to find any common thread between instances where this happens? I put code in place to prevent this exact thing so I am not really sure what's going on there. Might be something related to the number of writen lines being taken into account instead of actual window lines. Need to investigate a bit further, but any additional info would be awesome!

Thanks for reporting this issue!

xeluxee commented 2 years ago

Did you manage to find any common thread between instances where this happens?

I've tried it, but I can't understand why it happens only sometimes (or to be more accurate it happens only with some code, as the one specified above) I'll investigate on this Could barbar.nvim be related some way since it occupies the first line of the terminal?

Thanks for reporting this issue!

Thank you for maintaining this plugin

filipdutescu commented 2 years ago

I would assume, that the code which breaks it only has 2-3 lines. On larger files, most likely, you do not see that. Is this correct?

xeluxee commented 2 years ago

On larger files, most likely, you do not see that. Is this correct?

Yeah you're correct. It works well with files that are made by 5 lines or more

filipdutescu commented 2 years ago

As a slight update, managed to isolate the problem, I am currently working on a fix. Seems like I need to take into account both window height and buffer line count when deciding if the popup should be flipped (which is what leads to the popup being drawn above its intended place, leading to the cropping you see).