mirror of
https://github.com/vim/vim.git
synced 2025-11-08 10:27:32 -05:00
patch 8.1.2009: cursorline highlighting not updated in popup window
Problem: Cursorline highlighting not updated in popup window. (Marko
Mahnič)
Solution: Check if the cursor position changed. (closes #4912)
This commit is contained in:
@@ -542,8 +542,15 @@ popup_show_curline(win_T *wp)
|
||||
{
|
||||
if (wp->w_cursor.lnum < wp->w_topline)
|
||||
wp->w_topline = wp->w_cursor.lnum;
|
||||
else if (wp->w_cursor.lnum >= wp->w_botline)
|
||||
else if (wp->w_cursor.lnum >= wp->w_botline
|
||||
&& (curwin->w_valid & VALID_BOTLINE))
|
||||
{
|
||||
wp->w_topline = wp->w_cursor.lnum - wp->w_height + 1;
|
||||
if (wp->w_topline < 1)
|
||||
wp->w_topline = 1;
|
||||
else if (wp->w_topline > wp->w_buffer->b_ml.ml_line_count)
|
||||
wp->w_topline = wp->w_buffer->b_ml.ml_line_count;
|
||||
}
|
||||
|
||||
// Don't use "firstline" now.
|
||||
wp->w_firstline = 0;
|
||||
@@ -593,6 +600,7 @@ popup_highlight_curline(win_T *wp)
|
||||
}
|
||||
else
|
||||
sign_undefine_by_name(sign_name, FALSE);
|
||||
wp->w_popup_last_curline = wp->w_cursor.lnum;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1059,6 +1067,11 @@ popup_adjust_position(win_T *wp)
|
||||
wp->w_popup_leftoff = 0;
|
||||
wp->w_popup_rightoff = 0;
|
||||
|
||||
// May need to update the "cursorline" highlighting, which may also change
|
||||
// "topline"
|
||||
if (wp->w_popup_last_curline != wp->w_cursor.lnum)
|
||||
popup_highlight_curline(wp);
|
||||
|
||||
// If no line was specified default to vertical centering.
|
||||
if (wantline == 0)
|
||||
center_vert = TRUE;
|
||||
@@ -1159,7 +1172,9 @@ popup_adjust_position(win_T *wp)
|
||||
// start at the desired first line
|
||||
if (wp->w_firstline > 0)
|
||||
wp->w_topline = wp->w_firstline;
|
||||
if (wp->w_topline > wp->w_buffer->b_ml.ml_line_count)
|
||||
if (wp->w_topline < 1)
|
||||
wp->w_topline = 1;
|
||||
else if (wp->w_topline > wp->w_buffer->b_ml.ml_line_count)
|
||||
wp->w_topline = wp->w_buffer->b_ml.ml_line_count;
|
||||
|
||||
// Compute width based on longest text line and the 'wrap' option.
|
||||
@@ -2998,6 +3013,7 @@ check_popup_unhidden(win_T *wp)
|
||||
* Return TRUE if popup_adjust_position() needs to be called for "wp".
|
||||
* That is when the buffer in the popup was changed, or the popup is following
|
||||
* a textprop and the referenced buffer was changed.
|
||||
* Or when the cursor line changed and "cursorline" is set.
|
||||
*/
|
||||
static int
|
||||
popup_need_position_adjust(win_T *wp)
|
||||
@@ -3007,7 +3023,9 @@ popup_need_position_adjust(win_T *wp)
|
||||
if (win_valid(wp->w_popup_prop_win))
|
||||
return wp->w_popup_prop_changedtick
|
||||
!= CHANGEDTICK(wp->w_popup_prop_win->w_buffer)
|
||||
|| wp->w_popup_prop_topline != wp->w_popup_prop_win->w_topline;
|
||||
|| wp->w_popup_prop_topline != wp->w_popup_prop_win->w_topline
|
||||
|| ((wp->w_popup_flags & POPF_CURSORLINE)
|
||||
&& wp->w_cursor.lnum != wp->w_popup_last_curline);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user