summaryrefslogtreecommitdiff
path: root/src/popupwin.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/popupwin.c')
-rw-r--r--src/popupwin.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/popupwin.c b/src/popupwin.c
index d29986db5..6080ecbc0 100644
--- a/src/popupwin.c
+++ b/src/popupwin.c
@@ -593,8 +593,9 @@ popup_show_curline(win_T *wp)
++wp->w_topline;
}
- // Don't use "firstline" now.
- wp->w_firstline = 0;
+ // Don't let "firstline" cause a scroll.
+ if (wp->w_firstline > 0)
+ wp->w_firstline = wp->w_topline;
}
/*
@@ -948,6 +949,18 @@ apply_options(win_T *wp, dict_T *dict)
if (nr > 0)
wp->w_popup_flags |= POPF_HIDDEN;
+ // when "firstline" and "cursorline" are both set move the cursor to the
+ // "firstline".
+ if (wp->w_firstline > 0 && (wp->w_popup_flags & POPF_CURSORLINE))
+ {
+ if (wp->w_firstline > wp->w_buffer->b_ml.ml_line_count)
+ wp->w_cursor.lnum = wp->w_buffer->b_ml.ml_line_count;
+ else
+ wp->w_cursor.lnum = wp->w_firstline;
+ wp->w_topline = wp->w_cursor.lnum;
+ curwin->w_valid &= ~VALID_BOTLINE;
+ }
+
popup_mask_refresh = TRUE;
popup_highlight_curline(wp);
}