Skip to content

Conversation

@shuber2
Copy link

@shuber2 shuber2 commented Jan 25, 2026

If winborder option is set in neovim then cmdborder needs to be increased for the window not to overlap with cmdline. Fix this in s:get_position().

If winborder option is set in neovim then cmdborder needs to be
increased for the window not to overlap with cmdline. Fix this in
s:get_position().
Copilot AI review requested due to automatic review settings January 25, 2026 00:07
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR attempts to address an issue where the popup menu overlaps with the command line when a window border is set in Neovim. The fix adds logic to increase the cmdheight calculation by 2 when the winborder option is detected and set to a non-empty, non-'none' value.

Changes:

  • Modified s:get_position() function to check for winborder option existence
  • Added conditional logic to increase cmdheight by 2 when borders are enabled

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


let l:cmdheight = wilder#renderer#get_cmdheight()
if exists('&winborder')
if &winborder !=# '' && &winborder !=# 'none'
Copy link

Copilot AI Jan 25, 2026

Choose a reason for hiding this comment

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

The magic number 2 for the cmdheight adjustment lacks documentation or justification. It's unclear why the cmdheight should be increased by exactly 2 when a border is present. This value should either be:

  1. Documented with a comment explaining why 2 is the correct value
  2. Made configurable if different border styles require different adjustments
  3. Calculated based on actual border dimensions

Additionally, this assumes all borders add the same amount of space, which may not be true for different border configurations.

Suggested change
if &winborder !=# '' && &winborder !=# 'none'
if &winborder !=# '' && &winborder !=# 'none'
" Account for one line above and one line below the popup when a window
" border is present. This assumes standard &winborder styles that add
" exactly one line on the top and bottom.

Copilot uses AI. Check for mistakes.

let l:cmdheight = wilder#renderer#get_cmdheight()
if exists('&winborder')
if &winborder !=# '' && &winborder !=# 'none'
Copy link

Copilot AI Jan 25, 2026

Choose a reason for hiding this comment

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

The condition checks if &winborder is not empty and not 'none', but doesn't validate what valid values for this option might be. If the option does exist (which needs verification), the check should validate against the actual valid values for the option rather than just checking if it's non-empty and not 'none'. This could lead to incorrect behavior if the option is set to an invalid or unexpected value.

Copilot uses AI. Check for mistakes.
Comment on lines +866 to +870
if exists('&winborder')
if &winborder !=# '' && &winborder !=# 'none'
let l:cmdheight += 2
endif
endif
Copy link

Copilot AI Jan 25, 2026

Choose a reason for hiding this comment

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

The option 'winborder' does not exist in standard Neovim. As of Neovim 0.10, there is no global &winborder option. Floating windows can have borders configured via the border parameter in nvim_open_win(), but this is not a global option that can be checked with exists('&winborder').

If this is intended to check for a future Neovim option or a custom option, please verify that such an option actually exists. Otherwise, this code will never execute as exists('&winborder') will always return false.

Suggested change
if exists('&winborder')
if &winborder !=# '' && &winborder !=# 'none'
let l:cmdheight += 2
endif
endif

Copilot uses AI. Check for mistakes.
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