mirror of
https://github.com/neovim/neovim.git
synced 2025-09-29 06:28:35 +00:00
refactor: rename w_float_config to w_config #27419
Follows up on rename of `FloatConfig` to `WinConfig` in #27397.
This commit is contained in:
@@ -257,7 +257,7 @@ Window nvim_open_win(Buffer buffer, Boolean enter, Dict(win_config) *config, Err
|
|||||||
restore_win(&switchwin, true);
|
restore_win(&switchwin, true);
|
||||||
}
|
}
|
||||||
if (wp) {
|
if (wp) {
|
||||||
wp->w_float_config = fconfig;
|
wp->w_config = fconfig;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
wp = win_new_float(NULL, false, fconfig, err);
|
wp = win_new_float(NULL, false, fconfig, err);
|
||||||
@@ -345,7 +345,7 @@ void nvim_win_set_config(Window window, Dict(win_config) *config, Error *err)
|
|||||||
bool has_split = HAS_KEY_X(config, split);
|
bool has_split = HAS_KEY_X(config, split);
|
||||||
bool has_vertical = HAS_KEY_X(config, vertical);
|
bool has_vertical = HAS_KEY_X(config, vertical);
|
||||||
// reuse old values, if not overridden
|
// reuse old values, if not overridden
|
||||||
WinConfig fconfig = win->w_float_config;
|
WinConfig fconfig = win->w_config;
|
||||||
|
|
||||||
bool to_split = config->relative.size == 0
|
bool to_split = config->relative.size == 0
|
||||||
&& !(HAS_KEY_X(config, external) ? config->external : fconfig.external)
|
&& !(HAS_KEY_X(config, external) ? config->external : fconfig.external)
|
||||||
@@ -387,7 +387,7 @@ void nvim_win_set_config(Window window, Dict(win_config) *config, Error *err)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
win->w_float_config = fconfig;
|
win->w_config = fconfig;
|
||||||
|
|
||||||
// If there's no "vertical" or "split" set, or if "split" is unchanged,
|
// If there's no "vertical" or "split" set, or if "split" is unchanged,
|
||||||
// then we can just change the size of the window.
|
// then we can just change the size of the window.
|
||||||
@@ -477,7 +477,7 @@ void nvim_win_set_config(Window window, Dict(win_config) *config, Error *err)
|
|||||||
} else {
|
} else {
|
||||||
win_remove(win, win_tp == curtab ? NULL : win_tp);
|
win_remove(win, win_tp == curtab ? NULL : win_tp);
|
||||||
ui_comp_remove_grid(&win->w_grid_alloc);
|
ui_comp_remove_grid(&win->w_grid_alloc);
|
||||||
if (win->w_float_config.external) {
|
if (win->w_config.external) {
|
||||||
for (tabpage_T *tp = first_tabpage; tp != NULL; tp = tp->tp_next) {
|
for (tabpage_T *tp = first_tabpage; tp != NULL; tp = tp->tp_next) {
|
||||||
if (tp == curtab) {
|
if (tp == curtab) {
|
||||||
continue;
|
continue;
|
||||||
@@ -607,7 +607,7 @@ Dict(win_config) nvim_win_get_config(Window window, Arena *arena, Error *err)
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
WinConfig *config = &wp->w_float_config;
|
WinConfig *config = &wp->w_config;
|
||||||
|
|
||||||
PUT_KEY_X(rv, focusable, config->focusable);
|
PUT_KEY_X(rv, focusable, config->focusable);
|
||||||
PUT_KEY_X(rv, external, config->external);
|
PUT_KEY_X(rv, external, config->external);
|
||||||
|
@@ -1335,7 +1335,7 @@ void aucmd_prepbuf(aco_save_T *aco, buf_T *buf)
|
|||||||
if (need_append) {
|
if (need_append) {
|
||||||
win_append(lastwin, auc_win);
|
win_append(lastwin, auc_win);
|
||||||
pmap_put(int)(&window_handles, auc_win->handle, auc_win);
|
pmap_put(int)(&window_handles, auc_win->handle, auc_win);
|
||||||
win_config_float(auc_win, auc_win->w_float_config);
|
win_config_float(auc_win, auc_win->w_config);
|
||||||
}
|
}
|
||||||
// Prevent chdir() call in win_enter_ext(), through do_autochdir()
|
// Prevent chdir() call in win_enter_ext(), through do_autochdir()
|
||||||
int save_acd = p_acd;
|
int save_acd = p_acd;
|
||||||
|
@@ -2773,7 +2773,7 @@ void get_winopts(buf_T *buf)
|
|||||||
curwin->w_changelistidx = wip->wi_changelistidx;
|
curwin->w_changelistidx = wip->wi_changelistidx;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (curwin->w_float_config.style == kWinStyleMinimal) {
|
if (curwin->w_config.style == kWinStyleMinimal) {
|
||||||
didset_window_options(curwin, false);
|
didset_window_options(curwin, false);
|
||||||
win_set_minimal_style(curwin);
|
win_set_minimal_style(curwin);
|
||||||
}
|
}
|
||||||
|
@@ -913,6 +913,7 @@ typedef enum {
|
|||||||
kBorderTextFooter = 1,
|
kBorderTextFooter = 1,
|
||||||
} BorderTextType;
|
} BorderTextType;
|
||||||
|
|
||||||
|
/// See ":help nvim_open_win()" for documentation.
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Window window;
|
Window window;
|
||||||
lpos_T bufpos;
|
lpos_T bufpos;
|
||||||
@@ -1278,7 +1279,7 @@ struct window_S {
|
|||||||
bool w_pos_changed; // true if window position changed
|
bool w_pos_changed; // true if window position changed
|
||||||
bool w_floating; ///< whether the window is floating
|
bool w_floating; ///< whether the window is floating
|
||||||
bool w_float_is_info; // the floating window is info float
|
bool w_float_is_info; // the floating window is info float
|
||||||
WinConfig w_float_config;
|
WinConfig w_config;
|
||||||
|
|
||||||
// w_fraction is the fractional row of the cursor within the window, from
|
// w_fraction is the fractional row of the cursor within the window, from
|
||||||
// 0 at the top row to FRACTION_MULT at the last row.
|
// 0 at the top row to FRACTION_MULT at the last row.
|
||||||
|
@@ -738,7 +738,7 @@ int win_get_bordertext_col(int total_col, int text_width, AlignTextPos align)
|
|||||||
static void win_redr_border(win_T *wp)
|
static void win_redr_border(win_T *wp)
|
||||||
{
|
{
|
||||||
wp->w_redr_border = false;
|
wp->w_redr_border = false;
|
||||||
if (!(wp->w_floating && wp->w_float_config.border)) {
|
if (!(wp->w_floating && wp->w_config.border)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -746,9 +746,9 @@ static void win_redr_border(win_T *wp)
|
|||||||
|
|
||||||
schar_T chars[8];
|
schar_T chars[8];
|
||||||
for (int i = 0; i < 8; i++) {
|
for (int i = 0; i < 8; i++) {
|
||||||
chars[i] = schar_from_str(wp->w_float_config.border_chars[i]);
|
chars[i] = schar_from_str(wp->w_config.border_chars[i]);
|
||||||
}
|
}
|
||||||
int *attrs = wp->w_float_config.border_attr;
|
int *attrs = wp->w_config.border_attr;
|
||||||
|
|
||||||
int *adj = wp->w_border_adj;
|
int *adj = wp->w_border_adj;
|
||||||
int irow = wp->w_height_inner + wp->w_winbar_height;
|
int irow = wp->w_height_inner + wp->w_winbar_height;
|
||||||
@@ -764,10 +764,10 @@ static void win_redr_border(win_T *wp)
|
|||||||
grid_line_put_schar(i + adj[3], chars[1], attrs[1]);
|
grid_line_put_schar(i + adj[3], chars[1], attrs[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wp->w_float_config.title) {
|
if (wp->w_config.title) {
|
||||||
int title_col = win_get_bordertext_col(icol, wp->w_float_config.title_width,
|
int title_col = win_get_bordertext_col(icol, wp->w_config.title_width,
|
||||||
wp->w_float_config.title_pos);
|
wp->w_config.title_pos);
|
||||||
win_redr_bordertext(wp, wp->w_float_config.title_chunks, title_col);
|
win_redr_bordertext(wp, wp->w_config.title_chunks, title_col);
|
||||||
}
|
}
|
||||||
if (adj[1]) {
|
if (adj[1]) {
|
||||||
grid_line_put_schar(icol + adj[3], chars[2], attrs[2]);
|
grid_line_put_schar(icol + adj[3], chars[2], attrs[2]);
|
||||||
@@ -800,10 +800,10 @@ static void win_redr_border(win_T *wp)
|
|||||||
grid_line_put_schar(i + adj[3], chars[ic], attrs[ic]);
|
grid_line_put_schar(i + adj[3], chars[ic], attrs[ic]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wp->w_float_config.footer) {
|
if (wp->w_config.footer) {
|
||||||
int footer_col = win_get_bordertext_col(icol, wp->w_float_config.footer_width,
|
int footer_col = win_get_bordertext_col(icol, wp->w_config.footer_width,
|
||||||
wp->w_float_config.footer_pos);
|
wp->w_config.footer_pos);
|
||||||
win_redr_bordertext(wp, wp->w_float_config.footer_chunks, footer_col);
|
win_redr_bordertext(wp, wp->w_config.footer_chunks, footer_col);
|
||||||
}
|
}
|
||||||
if (adj[1]) {
|
if (adj[1]) {
|
||||||
grid_line_put_schar(icol + adj[3], chars[4], attrs[4]);
|
grid_line_put_schar(icol + adj[3], chars[4], attrs[4]);
|
||||||
|
@@ -551,7 +551,7 @@ void ex_listdo(exarg_T *eap)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
assert(wp);
|
assert(wp);
|
||||||
execute = !wp->w_floating || wp->w_float_config.focusable;
|
execute = !wp->w_floating || wp->w_config.focusable;
|
||||||
if (execute) {
|
if (execute) {
|
||||||
win_goto(wp);
|
win_goto(wp);
|
||||||
if (curwin != wp) {
|
if (curwin != wp) {
|
||||||
|
@@ -912,7 +912,7 @@ void win_grid_alloc(win_T *wp)
|
|||||||
grid_alloc(grid_allocated, total_rows, total_cols,
|
grid_alloc(grid_allocated, total_rows, total_cols,
|
||||||
wp->w_grid_alloc.valid, false);
|
wp->w_grid_alloc.valid, false);
|
||||||
grid_allocated->valid = true;
|
grid_allocated->valid = true;
|
||||||
if (wp->w_floating && wp->w_float_config.border) {
|
if (wp->w_floating && wp->w_config.border) {
|
||||||
wp->w_redr_border = true;
|
wp->w_redr_border = true;
|
||||||
}
|
}
|
||||||
was_resized = true;
|
was_resized = true;
|
||||||
|
@@ -369,7 +369,7 @@ void update_window_hl(win_T *wp, bool invalid)
|
|||||||
// wp->w_hl_attr_normal group. HL_ATTR(HLF_NFLOAT) is always named.
|
// wp->w_hl_attr_normal group. HL_ATTR(HLF_NFLOAT) is always named.
|
||||||
|
|
||||||
// determine window specific background set in 'winhighlight'
|
// determine window specific background set in 'winhighlight'
|
||||||
bool float_win = wp->w_floating && !wp->w_float_config.external;
|
bool float_win = wp->w_floating && !wp->w_config.external;
|
||||||
if (float_win && hl_def[HLF_NFLOAT] != 0) {
|
if (float_win && hl_def[HLF_NFLOAT] != 0) {
|
||||||
wp->w_hl_attr_normal = hl_def[HLF_NFLOAT];
|
wp->w_hl_attr_normal = hl_def[HLF_NFLOAT];
|
||||||
} else if (hl_def[HLF_COUNT] > 0) {
|
} else if (hl_def[HLF_COUNT] > 0) {
|
||||||
@@ -382,19 +382,19 @@ void update_window_hl(win_T *wp, bool invalid)
|
|||||||
wp->w_hl_attr_normal = hl_apply_winblend(wp, wp->w_hl_attr_normal);
|
wp->w_hl_attr_normal = hl_apply_winblend(wp, wp->w_hl_attr_normal);
|
||||||
}
|
}
|
||||||
|
|
||||||
wp->w_float_config.shadow = false;
|
wp->w_config.shadow = false;
|
||||||
if (wp->w_floating && wp->w_float_config.border) {
|
if (wp->w_floating && wp->w_config.border) {
|
||||||
for (int i = 0; i < 8; i++) {
|
for (int i = 0; i < 8; i++) {
|
||||||
int attr = hl_def[HLF_BORDER];
|
int attr = hl_def[HLF_BORDER];
|
||||||
if (wp->w_float_config.border_hl_ids[i]) {
|
if (wp->w_config.border_hl_ids[i]) {
|
||||||
attr = hl_get_ui_attr(ns_id, HLF_BORDER,
|
attr = hl_get_ui_attr(ns_id, HLF_BORDER,
|
||||||
wp->w_float_config.border_hl_ids[i], false);
|
wp->w_config.border_hl_ids[i], false);
|
||||||
}
|
}
|
||||||
attr = hl_apply_winblend(wp, attr);
|
attr = hl_apply_winblend(wp, attr);
|
||||||
if (syn_attr2entry(attr).hl_blend > 0) {
|
if (syn_attr2entry(attr).hl_blend > 0) {
|
||||||
wp->w_float_config.shadow = true;
|
wp->w_config.shadow = true;
|
||||||
}
|
}
|
||||||
wp->w_float_config.border_attr[i] = attr;
|
wp->w_config.border_attr[i] = attr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1722,7 +1722,7 @@ static win_T *mouse_find_grid_win(int *gridp, int *rowp, int *colp)
|
|||||||
} else if (*gridp > 1) {
|
} else if (*gridp > 1) {
|
||||||
win_T *wp = get_win_by_grid_handle(*gridp);
|
win_T *wp = get_win_by_grid_handle(*gridp);
|
||||||
if (wp && wp->w_grid_alloc.chars
|
if (wp && wp->w_grid_alloc.chars
|
||||||
&& !(wp->w_floating && !wp->w_float_config.focusable)) {
|
&& !(wp->w_floating && !wp->w_config.focusable)) {
|
||||||
*rowp = MIN(*rowp - wp->w_grid.row_offset, wp->w_grid.rows - 1);
|
*rowp = MIN(*rowp - wp->w_grid.row_offset, wp->w_grid.rows - 1);
|
||||||
*colp = MIN(*colp - wp->w_grid.col_offset, wp->w_grid.cols - 1);
|
*colp = MIN(*colp - wp->w_grid.col_offset, wp->w_grid.cols - 1);
|
||||||
return wp;
|
return wp;
|
||||||
|
@@ -1790,7 +1790,7 @@ bool valid_name(const char *val, const char *allowed)
|
|||||||
void check_blending(win_T *wp)
|
void check_blending(win_T *wp)
|
||||||
{
|
{
|
||||||
wp->w_grid_alloc.blending =
|
wp->w_grid_alloc.blending =
|
||||||
wp->w_p_winbl > 0 || (wp->w_floating && wp->w_float_config.shadow);
|
wp->w_p_winbl > 0 || (wp->w_floating && wp->w_config.shadow);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Handle setting `winhighlight' in window "wp"
|
/// Handle setting `winhighlight' in window "wp"
|
||||||
|
@@ -744,16 +744,16 @@ static void pum_adjust_float_position(win_T *wp, int height, int width)
|
|||||||
{
|
{
|
||||||
// when floating window in right and right no enough room to show
|
// when floating window in right and right no enough room to show
|
||||||
// but left has enough room, adjust floating window to left.
|
// but left has enough room, adjust floating window to left.
|
||||||
if (wp->w_float_config.width < width && wp->w_float_config.col > pum_col) {
|
if (wp->w_config.width < width && wp->w_config.col > pum_col) {
|
||||||
if ((pum_col - 2) > width) {
|
if ((pum_col - 2) > width) {
|
||||||
wp->w_float_config.width = width;
|
wp->w_config.width = width;
|
||||||
wp->w_float_config.col = pum_col - width - 1;
|
wp->w_config.col = pum_col - width - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
wp->w_float_config.width = MIN(wp->w_float_config.width, width);
|
wp->w_config.width = MIN(wp->w_config.width, width);
|
||||||
wp->w_float_config.height = MIN(Rows, height);
|
wp->w_config.height = MIN(Rows, height);
|
||||||
wp->w_float_config.hide = false;
|
wp->w_config.hide = false;
|
||||||
win_config_float(wp, wp->w_float_config);
|
win_config_float(wp, wp->w_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// used in nvim_complete_set
|
/// used in nvim_complete_set
|
||||||
|
@@ -692,9 +692,9 @@ void ui_grid_resize(handle_T grid_handle, int width, int height, Error *err)
|
|||||||
|
|
||||||
if (wp->w_floating) {
|
if (wp->w_floating) {
|
||||||
if (width != wp->w_width || height != wp->w_height) {
|
if (width != wp->w_width || height != wp->w_height) {
|
||||||
wp->w_float_config.width = width;
|
wp->w_config.width = width;
|
||||||
wp->w_float_config.height = height;
|
wp->w_config.height = height;
|
||||||
win_config_float(wp, wp->w_float_config);
|
win_config_float(wp, wp->w_config);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// non-positive indicates no request
|
// non-positive indicates no request
|
||||||
|
@@ -328,13 +328,13 @@ newwindow:
|
|||||||
wp = lastwin; // wrap around
|
wp = lastwin; // wrap around
|
||||||
}
|
}
|
||||||
while (wp != NULL && wp->w_floating
|
while (wp != NULL && wp->w_floating
|
||||||
&& !wp->w_float_config.focusable) {
|
&& !wp->w_config.focusable) {
|
||||||
wp = wp->w_prev;
|
wp = wp->w_prev;
|
||||||
}
|
}
|
||||||
} else { // go to next window
|
} else { // go to next window
|
||||||
wp = curwin->w_next;
|
wp = curwin->w_next;
|
||||||
while (wp != NULL && wp->w_floating
|
while (wp != NULL && wp->w_floating
|
||||||
&& !wp->w_float_config.focusable) {
|
&& !wp->w_config.focusable) {
|
||||||
wp = wp->w_next;
|
wp = wp->w_next;
|
||||||
}
|
}
|
||||||
if (wp == NULL) {
|
if (wp == NULL) {
|
||||||
@@ -763,7 +763,7 @@ void ui_ext_win_position(win_T *wp, bool validate)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
WinConfig c = wp->w_float_config;
|
WinConfig c = wp->w_config;
|
||||||
if (!c.external) {
|
if (!c.external) {
|
||||||
ScreenGrid *grid = &default_grid;
|
ScreenGrid *grid = &default_grid;
|
||||||
Float row = c.row;
|
Float row = c.row;
|
||||||
@@ -794,7 +794,7 @@ void ui_ext_win_position(win_T *wp, bool validate)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wp->w_grid_alloc.zindex = wp->w_float_config.zindex;
|
wp->w_grid_alloc.zindex = wp->w_config.zindex;
|
||||||
if (ui_has(kUIMultigrid)) {
|
if (ui_has(kUIMultigrid)) {
|
||||||
String anchor = cstr_as_string(float_anchor_str[c.anchor]);
|
String anchor = cstr_as_string(float_anchor_str[c.anchor]);
|
||||||
if (!c.hide) {
|
if (!c.hide) {
|
||||||
@@ -830,7 +830,7 @@ void ui_ext_win_position(win_T *wp, bool validate)
|
|||||||
ui_comp_put_grid(&wp->w_grid_alloc, comp_row, comp_col,
|
ui_comp_put_grid(&wp->w_grid_alloc, comp_row, comp_col,
|
||||||
wp->w_height_outer, wp->w_width_outer, valid, false);
|
wp->w_height_outer, wp->w_width_outer, valid, false);
|
||||||
ui_check_cursor_grid(wp->w_grid_alloc.handle);
|
ui_check_cursor_grid(wp->w_grid_alloc.handle);
|
||||||
wp->w_grid_alloc.focusable = wp->w_float_config.focusable;
|
wp->w_grid_alloc.focusable = wp->w_config.focusable;
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
wp->w_grid_alloc.valid = false;
|
wp->w_grid_alloc.valid = false;
|
||||||
redraw_later(wp, UPD_NOT_VALID);
|
redraw_later(wp, UPD_NOT_VALID);
|
||||||
@@ -1213,7 +1213,7 @@ win_T *win_split_ins(int size, int flags, win_T *new_wp, int dir)
|
|||||||
new_frame(wp);
|
new_frame(wp);
|
||||||
wp->w_floating = false;
|
wp->w_floating = false;
|
||||||
// non-floating window doesn't store float config or have a border.
|
// non-floating window doesn't store float config or have a border.
|
||||||
wp->w_float_config = WIN_CONFIG_INIT;
|
wp->w_config = WIN_CONFIG_INIT;
|
||||||
CLEAR_FIELD(wp->w_border_adj);
|
CLEAR_FIELD(wp->w_border_adj);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2757,7 +2757,7 @@ int win_close(win_T *win, bool free_buf, bool force)
|
|||||||
if (win->w_floating) {
|
if (win->w_floating) {
|
||||||
ui_comp_remove_grid(&win->w_grid_alloc);
|
ui_comp_remove_grid(&win->w_grid_alloc);
|
||||||
assert(first_tabpage != NULL); // suppress clang "Dereference of NULL pointer"
|
assert(first_tabpage != NULL); // suppress clang "Dereference of NULL pointer"
|
||||||
if (win->w_float_config.external) {
|
if (win->w_config.external) {
|
||||||
for (tabpage_T *tp = first_tabpage; tp != NULL; tp = tp->tp_next) {
|
for (tabpage_T *tp = first_tabpage; tp != NULL; tp = tp->tp_next) {
|
||||||
if (tp == curtab) {
|
if (tp == curtab) {
|
||||||
continue;
|
continue;
|
||||||
@@ -4328,7 +4328,7 @@ static void tabpage_check_windows(tabpage_T *old_curtab)
|
|||||||
for (win_T *wp = old_curtab->tp_firstwin; wp; wp = next_wp) {
|
for (win_T *wp = old_curtab->tp_firstwin; wp; wp = next_wp) {
|
||||||
next_wp = wp->w_next;
|
next_wp = wp->w_next;
|
||||||
if (wp->w_floating) {
|
if (wp->w_floating) {
|
||||||
if (wp->w_float_config.external) {
|
if (wp->w_config.external) {
|
||||||
win_remove(wp, old_curtab);
|
win_remove(wp, old_curtab);
|
||||||
win_append(lastwin_nofloating(), wp);
|
win_append(lastwin_nofloating(), wp);
|
||||||
} else {
|
} else {
|
||||||
@@ -4339,8 +4339,8 @@ static void tabpage_check_windows(tabpage_T *old_curtab)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (win_T *wp = firstwin; wp; wp = wp->w_next) {
|
for (win_T *wp = firstwin; wp; wp = wp->w_next) {
|
||||||
if (wp->w_floating && !wp->w_float_config.external) {
|
if (wp->w_floating && !wp->w_config.external) {
|
||||||
win_config_float(wp, wp->w_float_config);
|
win_config_float(wp, wp->w_config);
|
||||||
}
|
}
|
||||||
wp->w_pos_changed = true;
|
wp->w_pos_changed = true;
|
||||||
}
|
}
|
||||||
@@ -4983,7 +4983,7 @@ win_T *win_alloc(win_T *after, bool hidden)
|
|||||||
new_wp->w_cursor.lnum = 1;
|
new_wp->w_cursor.lnum = 1;
|
||||||
new_wp->w_scbind_pos = 1;
|
new_wp->w_scbind_pos = 1;
|
||||||
new_wp->w_floating = 0;
|
new_wp->w_floating = 0;
|
||||||
new_wp->w_float_config = WIN_CONFIG_INIT;
|
new_wp->w_config = WIN_CONFIG_INIT;
|
||||||
new_wp->w_viewport_invalid = true;
|
new_wp->w_viewport_invalid = true;
|
||||||
new_wp->w_viewport_last_topline = 1;
|
new_wp->w_viewport_last_topline = 1;
|
||||||
|
|
||||||
@@ -5097,8 +5097,8 @@ void win_free(win_T *wp, tabpage_T *tp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// free the border text
|
// free the border text
|
||||||
clear_virttext(&wp->w_float_config.title_chunks);
|
clear_virttext(&wp->w_config.title_chunks);
|
||||||
clear_virttext(&wp->w_float_config.footer_chunks);
|
clear_virttext(&wp->w_config.footer_chunks);
|
||||||
|
|
||||||
clear_matches(wp);
|
clear_matches(wp);
|
||||||
|
|
||||||
@@ -5622,7 +5622,7 @@ int win_comp_pos(void)
|
|||||||
|
|
||||||
for (win_T *wp = lastwin; wp && wp->w_floating; wp = wp->w_prev) {
|
for (win_T *wp = lastwin; wp && wp->w_floating; wp = wp->w_prev) {
|
||||||
// float might be anchored to moved window
|
// float might be anchored to moved window
|
||||||
if (wp->w_float_config.relative == kFloatRelativeWindow) {
|
if (wp->w_config.relative == kFloatRelativeWindow) {
|
||||||
wp->w_pos_changed = true;
|
wp->w_pos_changed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5681,8 +5681,8 @@ void win_setheight_win(int height, win_T *win)
|
|||||||
height = MAX(height, (int)(win == curwin ? MAX(p_wmh, 1) : p_wmh) + win->w_winbar_height);
|
height = MAX(height, (int)(win == curwin ? MAX(p_wmh, 1) : p_wmh) + win->w_winbar_height);
|
||||||
|
|
||||||
if (win->w_floating) {
|
if (win->w_floating) {
|
||||||
win->w_float_config.height = height;
|
win->w_config.height = height;
|
||||||
win_config_float(win, win->w_float_config);
|
win_config_float(win, win->w_config);
|
||||||
redraw_later(win, UPD_VALID);
|
redraw_later(win, UPD_VALID);
|
||||||
} else {
|
} else {
|
||||||
frame_setheight(win->w_frame, height + win->w_hsep_height + win->w_status_height);
|
frame_setheight(win->w_frame, height + win->w_hsep_height + win->w_status_height);
|
||||||
@@ -5893,8 +5893,8 @@ void win_setwidth_win(int width, win_T *wp)
|
|||||||
width = 0;
|
width = 0;
|
||||||
}
|
}
|
||||||
if (wp->w_floating) {
|
if (wp->w_floating) {
|
||||||
wp->w_float_config.width = width;
|
wp->w_config.width = width;
|
||||||
win_config_float(wp, wp->w_float_config);
|
win_config_float(wp, wp->w_config);
|
||||||
redraw_later(wp, UPD_NOT_VALID);
|
redraw_later(wp, UPD_NOT_VALID);
|
||||||
} else {
|
} else {
|
||||||
frame_setwidth(wp->w_frame, width + wp->w_vsep_width);
|
frame_setwidth(wp->w_frame, width + wp->w_vsep_width);
|
||||||
|
@@ -161,17 +161,17 @@ void win_config_float(win_T *wp, WinConfig fconfig)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool change_external = fconfig.external != wp->w_float_config.external;
|
bool change_external = fconfig.external != wp->w_config.external;
|
||||||
bool change_border = (fconfig.border != wp->w_float_config.border
|
bool change_border = (fconfig.border != wp->w_config.border
|
||||||
|| memcmp(fconfig.border_hl_ids,
|
|| memcmp(fconfig.border_hl_ids,
|
||||||
wp->w_float_config.border_hl_ids,
|
wp->w_config.border_hl_ids,
|
||||||
sizeof fconfig.border_hl_ids) != 0);
|
sizeof fconfig.border_hl_ids) != 0);
|
||||||
|
|
||||||
wp->w_float_config = fconfig;
|
wp->w_config = fconfig;
|
||||||
|
|
||||||
bool has_border = wp->w_floating && wp->w_float_config.border;
|
bool has_border = wp->w_floating && wp->w_config.border;
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
int new_adj = has_border && wp->w_float_config.border_chars[2 * i + 1][0];
|
int new_adj = has_border && wp->w_config.border_chars[2 * i + 1][0];
|
||||||
if (new_adj != wp->w_border_adj[i]) {
|
if (new_adj != wp->w_border_adj[i]) {
|
||||||
change_border = true;
|
change_border = true;
|
||||||
wp->w_border_adj[i] = new_adj;
|
wp->w_border_adj[i] = new_adj;
|
||||||
@@ -193,11 +193,11 @@ void win_config_float(win_T *wp, WinConfig fconfig)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// compute initial position
|
// compute initial position
|
||||||
if (wp->w_float_config.relative == kFloatRelativeWindow) {
|
if (wp->w_config.relative == kFloatRelativeWindow) {
|
||||||
int row = (int)wp->w_float_config.row;
|
int row = (int)wp->w_config.row;
|
||||||
int col = (int)wp->w_float_config.col;
|
int col = (int)wp->w_config.col;
|
||||||
Error dummy = ERROR_INIT;
|
Error dummy = ERROR_INIT;
|
||||||
win_T *parent = find_window_by_handle(wp->w_float_config.window, &dummy);
|
win_T *parent = find_window_by_handle(wp->w_config.window, &dummy);
|
||||||
if (parent) {
|
if (parent) {
|
||||||
row += parent->w_winrow;
|
row += parent->w_winrow;
|
||||||
col += parent->w_wincol;
|
col += parent->w_wincol;
|
||||||
@@ -207,9 +207,9 @@ void win_config_float(win_T *wp, WinConfig fconfig)
|
|||||||
grid_adjust(&grid, &row_off, &col_off);
|
grid_adjust(&grid, &row_off, &col_off);
|
||||||
row += row_off;
|
row += row_off;
|
||||||
col += col_off;
|
col += col_off;
|
||||||
if (wp->w_float_config.bufpos.lnum >= 0) {
|
if (wp->w_config.bufpos.lnum >= 0) {
|
||||||
pos_T pos = { wp->w_float_config.bufpos.lnum + 1,
|
pos_T pos = { wp->w_config.bufpos.lnum + 1,
|
||||||
wp->w_float_config.bufpos.col, 0 };
|
wp->w_config.bufpos.col, 0 };
|
||||||
int trow, tcol, tcolc, tcole;
|
int trow, tcol, tcolc, tcole;
|
||||||
textpos2screenpos(parent, &pos, &trow, &tcol, &tcolc, &tcole, true);
|
textpos2screenpos(parent, &pos, &trow, &tcol, &tcolc, &tcole, true);
|
||||||
row += trow - 1;
|
row += trow - 1;
|
||||||
@@ -233,8 +233,8 @@ void win_config_float(win_T *wp, WinConfig fconfig)
|
|||||||
|
|
||||||
static int float_zindex_cmp(const void *a, const void *b)
|
static int float_zindex_cmp(const void *a, const void *b)
|
||||||
{
|
{
|
||||||
int za = (*(win_T **)a)->w_float_config.zindex;
|
int za = (*(win_T **)a)->w_config.zindex;
|
||||||
int zb = (*(win_T **)b)->w_float_config.zindex;
|
int zb = (*(win_T **)b)->w_config.zindex;
|
||||||
return za == zb ? 0 : za < zb ? 1 : -1;
|
return za == zb ? 0 : za < zb ? 1 : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -265,8 +265,8 @@ void win_check_anchored_floats(win_T *win)
|
|||||||
{
|
{
|
||||||
for (win_T *wp = lastwin; wp && wp->w_floating; wp = wp->w_prev) {
|
for (win_T *wp = lastwin; wp && wp->w_floating; wp = wp->w_prev) {
|
||||||
// float might be anchored to moved window
|
// float might be anchored to moved window
|
||||||
if (wp->w_float_config.relative == kFloatRelativeWindow
|
if (wp->w_config.relative == kFloatRelativeWindow
|
||||||
&& wp->w_float_config.window == win->handle) {
|
&& wp->w_config.window == win->handle) {
|
||||||
wp->w_pos_changed = true;
|
wp->w_pos_changed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -275,7 +275,7 @@ void win_check_anchored_floats(win_T *win)
|
|||||||
void win_reconfig_floats(void)
|
void win_reconfig_floats(void)
|
||||||
{
|
{
|
||||||
for (win_T *wp = lastwin; wp && wp->w_floating; wp = wp->w_prev) {
|
for (win_T *wp = lastwin; wp && wp->w_floating; wp = wp->w_prev) {
|
||||||
win_config_float(wp, wp->w_float_config);
|
win_config_float(wp, wp->w_config);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user