aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/drawscreen.c14
-rw-r--r--src/nvim/eval/typval.c2
-rw-r--r--src/nvim/mouse.c46
-rw-r--r--src/nvim/option.c23
-rw-r--r--src/nvim/popupmenu.c5
5 files changed, 53 insertions, 37 deletions
diff --git a/src/nvim/drawscreen.c b/src/nvim/drawscreen.c
index 71dbbdabfc..aa819c01a3 100644
--- a/src/nvim/drawscreen.c
+++ b/src/nvim/drawscreen.c
@@ -574,9 +574,9 @@ int update_screen(void)
draw_tabline();
}
- // Correct stored syntax highlighting info for changes in each displayed
- // buffer. Each buffer must only be done once.
FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
+ // Correct stored syntax highlighting info for changes in each displayed
+ // buffer. Each buffer must only be done once.
update_window_hl(wp, type >= UPD_NOT_VALID || hl_changed);
buf_T *buf = wp->w_buffer;
@@ -592,6 +592,11 @@ int update_screen(void)
buf->b_mod_tick_decor = display_tick;
}
}
+
+ // Reset 'statuscolumn' if there is no dedicated signcolumn but it is invalid.
+ if (*wp->w_p_stc != NUL && !wp->w_buffer->b_signcols.valid && win_no_signcol(wp)) {
+ wp->w_nrwidth_line_count = 0;
+ }
}
// Go from top to bottom through the windows, redrawing the ones that need it.
@@ -599,6 +604,11 @@ int update_screen(void)
screen_search_hl.rm.regprog = NULL;
FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
+ // Validate b_signcols if there is no dedicated signcolumn but 'statuscolumn' is set.
+ if (*wp->w_p_stc != NUL && win_no_signcol(wp)) {
+ buf_signcols(wp->w_buffer, 0);
+ }
+
if (wp->w_redr_type == UPD_CLEAR && wp->w_floating && wp->w_grid_alloc.chars) {
grid_invalidate(&wp->w_grid_alloc);
wp->w_redr_type = UPD_NOT_VALID;
diff --git a/src/nvim/eval/typval.c b/src/nvim/eval/typval.c
index 7c982de61e..357ef6414d 100644
--- a/src/nvim/eval/typval.c
+++ b/src/nvim/eval/typval.c
@@ -4224,7 +4224,7 @@ bool tv2bool(const typval_T *const tv)
case VAR_BOOL:
return tv->vval.v_bool == kBoolVarTrue;
case VAR_SPECIAL:
- return tv->vval.v_special == kSpecialVarNull;
+ return tv->vval.v_special != kSpecialVarNull;
case VAR_BLOB:
return tv->vval.v_blob != NULL && tv->vval.v_blob->bv_ga.ga_len > 0;
case VAR_UNKNOWN:
diff --git a/src/nvim/mouse.c b/src/nvim/mouse.c
index 28b40994a1..c00ccdd51a 100644
--- a/src/nvim/mouse.c
+++ b/src/nvim/mouse.c
@@ -212,22 +212,31 @@ static int get_fpos_of_mouse(pos_T *mpos)
if (wp == NULL) {
return IN_UNKNOWN;
}
+ int winrow = row;
+ int wincol = col;
+
+ // compute the position in the buffer line from the posn on the screen
+ bool below_buffer = mouse_comp_pos(wp, &row, &col, &mpos->lnum);
+
+ if (!below_buffer && *wp->w_p_stc != NUL && mouse_col < win_col_off(wp)) {
+ return MOUSE_STATUSCOL;
+ }
// winpos and height may change in win_enter()!
- if (row + wp->w_winbar_height >= wp->w_height) { // In (or below) status line
+ if (winrow + wp->w_winbar_height >= wp->w_height) { // In (or below) status line
return IN_STATUS_LINE;
}
- if (col >= wp->w_width) { // In vertical separator line
- return IN_SEP_LINE;
+
+ if (winrow == -1 && wp->w_winbar_height != 0) {
+ return MOUSE_WINBAR;
}
- if (wp != curwin) {
- return IN_UNKNOWN;
+ if (wincol >= wp->w_width) { // In vertical separator line
+ return IN_SEP_LINE;
}
- // compute the position in the buffer line from the posn on the screen
- if (mouse_comp_pos(curwin, &row, &col, &mpos->lnum)) {
- return IN_STATUS_LINE; // past bottom
+ if (wp != curwin || below_buffer) {
+ return IN_UNKNOWN;
}
mpos->col = vcol2col(wp, mpos->lnum, col);
@@ -530,6 +539,11 @@ bool do_mouse(oparg_T *oap, int c, int dir, long count, bool fixindent)
// shift-left button -> right button
// alt-left button -> alt-right button
if (mouse_model_popup()) {
+ pos_T m_pos;
+ int m_pos_flag = get_fpos_of_mouse(&m_pos);
+ if (m_pos_flag & (IN_STATUS_LINE|MOUSE_WINBAR|MOUSE_STATUSCOL)) {
+ goto popupexit;
+ }
if (which_button == MOUSE_RIGHT
&& !(mod_mask & (MOD_MASK_SHIFT | MOD_MASK_CTRL))) {
if (!is_click) {
@@ -539,17 +553,14 @@ bool do_mouse(oparg_T *oap, int c, int dir, long count, bool fixindent)
}
jump_flags = 0;
if (strcmp(p_mousem, "popup_setpos") == 0) {
- // First set the cursor position before showing the popup
- // menu.
+ // First set the cursor position before showing the popup menu.
if (VIsual_active) {
- pos_T m_pos;
- // set MOUSE_MAY_STOP_VIS if we are outside the
- // selection or the current window (might have false
- // negative here)
+ // set MOUSE_MAY_STOP_VIS if we are outside the selection
+ // or the current window (might have false negative here)
if (mouse_row < curwin->w_winrow
|| mouse_row > (curwin->w_winrow + curwin->w_height)) {
jump_flags = MOUSE_MAY_STOP_VIS;
- } else if (get_fpos_of_mouse(&m_pos) != IN_BUFFER) {
+ } else if (m_pos_flag != IN_BUFFER) {
jump_flags = MOUSE_MAY_STOP_VIS;
} else {
if (VIsual_mode == 'V') {
@@ -593,6 +604,7 @@ bool do_mouse(oparg_T *oap, int c, int dir, long count, bool fixindent)
mod_mask &= ~MOD_MASK_SHIFT;
}
}
+popupexit:
if ((State & (MODE_NORMAL | MODE_INSERT))
&& !(mod_mask & (MOD_MASK_SHIFT | MOD_MASK_CTRL))) {
@@ -644,7 +656,7 @@ bool do_mouse(oparg_T *oap, int c, int dir, long count, bool fixindent)
in_sep_line = (jump_flags & IN_SEP_LINE);
if ((in_winbar || in_status_line || in_statuscol) && is_click) {
- // Handle click event on window bar or status lin
+ // Handle click event on window bar, status line or status column
int click_grid = mouse_grid;
int click_row = mouse_row;
int click_col = mouse_col;
@@ -672,7 +684,7 @@ bool do_mouse(oparg_T *oap, int c, int dir, long count, bool fixindent)
call_click_def_func(click_defs, click_col, which_button);
break;
default:
- assert(false && "winbar and statusline only support %@ for clicks");
+ assert(false && "winbar, statusline and statuscolumn only support %@ for clicks");
break;
}
}
diff --git a/src/nvim/option.c b/src/nvim/option.c
index 69e7bb4b21..0ad11fb3cb 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -5947,6 +5947,14 @@ int win_signcol_count(win_T *wp)
return win_signcol_configured(wp, NULL);
}
+/// Return true when window "wp" has no sign column.
+bool win_no_signcol(win_T *wp)
+{
+ const char *scl = wp->w_p_scl;
+ return (*scl == 'n' && (*(scl + 1) == 'o' || (*(scl + 1) == 'u'
+ && (wp->w_p_nu || wp->w_p_rnu))));
+}
+
/// Return the number of requested sign columns, based on user / configuration.
int win_signcol_configured(win_T *wp, int *is_fixed)
{
@@ -5956,20 +5964,7 @@ int win_signcol_configured(win_T *wp, int *is_fixed)
*is_fixed = 1;
}
- // Note: It checks "no" or "number" in 'signcolumn' option
- if (*scl == 'n'
- && (*(scl + 1) == 'o' || (*(scl + 1) == 'u'
- && (wp->w_p_nu || wp->w_p_rnu)))) {
- if (!wp->w_buffer->b_signcols.valid) {
- FOR_ALL_WINDOWS_IN_TAB(win, curtab) {
- if (*win->w_p_stc != NUL) {
- win->w_nrwidth_line_count = 0;
- }
- }
- }
- if (*wp->w_p_stc != NUL) {
- buf_signcols(wp->w_buffer, 0);
- }
+ if (win_no_signcol(wp)) {
return 0;
}
diff --git a/src/nvim/popupmenu.c b/src/nvim/popupmenu.c
index 334a9bc904..9be005622b 100644
--- a/src/nvim/popupmenu.c
+++ b/src/nvim/popupmenu.c
@@ -399,6 +399,7 @@ void pum_display(pumitem_T *array, int size, int selected, bool array_changed, i
// room the window size will keep changing.
} while (pum_set_selected(selected, redo_count) && (++redo_count <= 2));
+ pum_grid.zindex = (State == MODE_CMDLINE) ? kZIndexCmdlinePopupMenu : kZIndexPopupMenu;
pum_redraw();
}
@@ -443,9 +444,6 @@ void pum_redraw(void)
grid_assign_handle(&pum_grid);
- pum_grid.zindex = ((State == MODE_CMDLINE)
- ? kZIndexCmdlinePopupMenu : kZIndexPopupMenu);
-
bool moved = ui_comp_put_grid(&pum_grid, pum_row, pum_col - col_off,
pum_height, grid_width, false, true);
bool invalid_grid = moved || pum_invalid;
@@ -1088,6 +1086,7 @@ void pum_show_popupmenu(vimmenu_T *menu)
for (;;) {
pum_is_visible = true;
pum_is_drawn = true;
+ pum_grid.zindex = kZIndexCmdlinePopupMenu; // show above cmdline area #23275
pum_redraw();
setcursor_mayforce(true);