diff options
Diffstat (limited to 'src/nvim/window.c')
-rw-r--r-- | src/nvim/window.c | 62 |
1 files changed, 42 insertions, 20 deletions
diff --git a/src/nvim/window.c b/src/nvim/window.c index d3280a3478..c3f3e075f1 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -857,7 +857,7 @@ void ui_ext_win_position(win_T *wp, bool validate) String anchor = cstr_as_string(float_anchor_str[c.anchor]); if (!c.hide) { ui_call_win_float_pos(wp->w_grid_alloc.handle, wp->handle, anchor, - grid->handle, row, col, c.focusable, + grid->handle, row, col, c.mouse, wp->w_grid_alloc.zindex); } else { ui_call_win_hide(wp->w_grid_alloc.handle); @@ -889,7 +889,7 @@ void ui_ext_win_position(win_T *wp, bool validate) ui_comp_put_grid(&wp->w_grid_alloc, comp_row, comp_col, 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_config.focusable; + wp->w_grid_alloc.mouse_enabled = wp->w_config.mouse; if (!valid) { wp->w_grid_alloc.valid = false; redraw_later(wp, UPD_NOT_VALID); @@ -4044,6 +4044,7 @@ void win_alloc_aucmd_win(int idx) fconfig.width = Columns; fconfig.height = 5; fconfig.focusable = false; + fconfig.mouse = false; aucmd_win[idx].auc_win = win_new_float(NULL, true, fconfig, &err); aucmd_win[idx].auc_win->w_buffer->b_nwindows--; RESET_BINDING(aucmd_win[idx].auc_win); @@ -6754,8 +6755,8 @@ void win_comp_scroll(win_T *wp) if (wp->w_p_scr != old_w_p_scr) { // Used by "verbose set scroll". - wp->w_p_script_ctx[WV_SCROLL].script_ctx.sc_sid = SID_WINLAYOUT; - wp->w_p_script_ctx[WV_SCROLL].script_ctx.sc_lnum = 0; + wp->w_p_script_ctx[kWinOptScroll].script_ctx.sc_sid = SID_WINLAYOUT; + wp->w_p_script_ctx[kWinOptScroll].script_ctx.sc_lnum = 0; } } @@ -6813,11 +6814,13 @@ void command_height(void) // Recompute window positions. win_comp_pos(); - // clear the lines added to cmdline - if (full_screen) { - grid_clear(&default_grid, cmdline_row, Rows, 0, Columns, 0); + if (!need_wait_return) { + // clear the lines added to cmdline + if (full_screen) { + grid_clear(&default_grid, cmdline_row, Rows, 0, Columns, 0); + } + msg_row = cmdline_row; } - msg_row = cmdline_row; redraw_cmdline = true; return; } @@ -7370,18 +7373,37 @@ static int int_cmp(const void *pa, const void *pb) return a == b ? 0 : a < b ? -1 : 1; } -/// Handle setting 'colorcolumn' or 'textwidth' in window "wp". +/// Check "cc" as 'colorcolumn' and update the members of "wp". +/// This is called when 'colorcolumn' or 'textwidth' is changed. +/// +/// @param cc when NULL: use "wp->w_p_cc" +/// @param wp when NULL: only parse "cc" /// /// @return error message, NULL if it's OK. -const char *check_colorcolumn(win_T *wp) +const char *check_colorcolumn(char *cc, win_T *wp) { - if (wp->w_buffer == NULL) { + if (wp != NULL && wp->w_buffer == NULL) { return NULL; // buffer was closed } + char *s = empty_string_option; + if (cc != NULL) { + s = cc; + } else if (wp != NULL) { + s = wp->w_p_cc; + } + + OptInt tw; + if (wp != NULL) { + tw = wp->w_buffer->b_p_tw; + } else { + // buffer-local value not set, assume zero + tw = 0; + } + unsigned count = 0; int color_cols[256]; - for (char *s = wp->w_p_cc; *s != NUL && count < 255;) { + while (*s != NUL && count < 255) { int col; if (*s == '-' || *s == '+') { // -N and +N: add to 'textwidth' @@ -7391,16 +7413,12 @@ const char *check_colorcolumn(win_T *wp) return e_invarg; } col = col * getdigits_int(&s, true, 0); - if (wp->w_buffer->b_p_tw == 0) { + if (tw == 0) { goto skip; // 'textwidth' not set, skip this item } - assert((col >= 0 - && wp->w_buffer->b_p_tw <= INT_MAX - col - && wp->w_buffer->b_p_tw + col >= INT_MIN) - || (col < 0 - && wp->w_buffer->b_p_tw >= INT_MIN - col - && wp->w_buffer->b_p_tw + col <= INT_MAX)); - col += (int)wp->w_buffer->b_p_tw; + assert((col >= 0 && tw <= INT_MAX - col && tw + col >= INT_MIN) + || (col < 0 && tw >= INT_MIN - col && tw + col <= INT_MAX)); + col += (int)tw; if (col < 0) { goto skip; } @@ -7422,6 +7440,10 @@ skip: } } + if (wp == NULL) { + return NULL; // only parse "cc" + } + xfree(wp->w_p_cc_cols); if (count == 0) { wp->w_p_cc_cols = NULL; |