aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/window.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/window.c')
-rw-r--r--src/nvim/window.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/src/nvim/window.c b/src/nvim/window.c
index 4fa6d8e63c..d4d00c0a71 100644
--- a/src/nvim/window.c
+++ b/src/nvim/window.c
@@ -676,9 +676,17 @@ void win_config_float(win_T *wp, FloatConfig fconfig)
wp->w_float_config = fconfig;
+ bool has_border = wp->w_floating && wp->w_float_config.border;
+ for (int i = 0; i < 4; i++) {
+ wp->w_border_adj[i] =
+ has_border && wp->w_float_config.border_chars[2 * i+1][0];
+ }
+
if (!ui_has(kUIMultigrid)) {
- wp->w_height = MIN(wp->w_height, Rows-1);
- wp->w_width = MIN(wp->w_width, Columns);
+ wp->w_height = MIN(wp->w_height,
+ Rows - 1 - (wp->w_border_adj[0] + wp->w_border_adj[2]));
+ wp->w_width = MIN(wp->w_width,
+ Columns - (wp->w_border_adj[1] + wp->w_border_adj[3]));
}
win_set_inner_size(wp);
@@ -767,14 +775,13 @@ void ui_ext_win_position(win_T *wp)
int comp_row = (int)row - (south ? wp->w_height : 0);
int comp_col = (int)col - (east ? wp->w_width : 0);
- comp_row = MAX(MIN(comp_row, Rows-wp->w_height-1), 0);
- comp_col = MAX(MIN(comp_col, Columns-wp->w_width), 0);
+ comp_row = MAX(MIN(comp_row, Rows-wp->w_height_outer-1), 0);
+ comp_col = MAX(MIN(comp_col, Columns-wp->w_width_outer), 0);
wp->w_winrow = comp_row;
wp->w_wincol = comp_col;
bool valid = (wp->w_redr_type == 0);
- bool on_top = (curwin == wp) || !curwin->w_floating;
ui_comp_put_grid(&wp->w_grid_alloc, comp_row, comp_col,
- wp->w_height_outer, wp->w_width_outer, valid, on_top);
+ wp->w_height_outer, wp->w_width_outer, valid, false);
ui_check_cursor_grid(wp->w_grid_alloc.handle);
wp->w_grid_alloc.focusable = wp->w_float_config.focusable;
if (!valid) {
@@ -2192,7 +2199,7 @@ bool one_nonfloat(void) FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
/// always false for a floating window
bool last_nonfloat(win_T *wp) FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
{
- return firstwin == wp && !(wp->w_next && !wp->w_floating);
+ return wp != NULL && firstwin == wp && !(wp->w_next && !wp->w_floating);
}
/// Close the possibly last window in a tab page.
@@ -5740,12 +5747,6 @@ void win_set_inner_size(win_T *wp)
terminal_check_size(wp->w_buffer->terminal);
}
- bool has_border = wp->w_floating && wp->w_float_config.border;
- for (int i = 0; i < 4; i++) {
- wp->w_border_adj[i] =
- has_border && wp->w_float_config.border_chars[2 * i+1][0];
- }
-
wp->w_height_outer = (wp->w_height_inner
+ wp->w_border_adj[0] + wp->w_border_adj[2]);
wp->w_width_outer = (wp->w_width_inner