mirror of
https://github.com/neovim/neovim.git
synced 2025-10-09 03:16:31 +00:00
fix(api): nvim_open_win respects requested split window size (#35601)
Problem: requested window size passed to nvim_open_win for splits may be ignored by win_split_ins if it decides to forcefully equalize window sizes instead (e.g: in an attempt to make room for the new window). Solution: try to set the size again if it differs from what was requested. Co-authored-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
This commit is contained in:
@@ -277,6 +277,13 @@ Window nvim_open_win(Buffer buffer, Boolean enter, Dict(win_config) *config, Err
|
||||
});
|
||||
if (wp) {
|
||||
wp->w_config = fconfig;
|
||||
// Without room for the requested size, window sizes may have been equalized instead.
|
||||
// If the size differs from what was requested, try to set it again now.
|
||||
if ((flags & WSP_VERT) && wp->w_width != fconfig.width) {
|
||||
win_setwidth_win(fconfig.width, wp);
|
||||
} else if (!(flags & WSP_VERT) && wp->w_height != fconfig.height) {
|
||||
win_setheight_win(fconfig.height, wp);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!check_split_disallowed_err(curwin, err)) {
|
||||
|
Reference in New Issue
Block a user