Mercurial > vim
diff src/popupwin.c @ 22357:0e231e8e70f8 v8.2.1727
patch 8.2.1727: a popup created with "cursorline" will ignore "firstline"
Commit: https://github.com/vim/vim/commit/99ca9c4868bb1669706b9e3de9a9218bd11cc459
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Sep 22 21:55:41 2020 +0200
patch 8.2.1727: a popup created with "cursorline" will ignore "firstline"
Problem: A popup created with "cursorline" will ignore "firstline".
Solution: When both "cursorline" and "firstline" are present put the cursor
on "firstline". (closes #7000) Add the "winid" argument to
getcurpos().
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 22 Sep 2020 22:00:03 +0200 |
parents | 6666ace75ef5 |
children | 997bbc35c181 |
line wrap: on
line diff
--- 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); }