forked from aniani/vim
patch 8.1.1608: the evalfunc.c file is too big
Problem: The evalfunc.c file is too big. Solution: Move sign functionality to sign.c.
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
*popup.txt* For Vim version 8.1. Last change: 2019 Jun 22
|
*popup.txt* For Vim version 8.1. Last change: 2019 Jun 29
|
||||||
|
|
||||||
|
|
||||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||||
@@ -86,9 +86,12 @@ that it is in.
|
|||||||
|
|
||||||
|
|
||||||
TODO:
|
TODO:
|
||||||
- click near top of scrollbar scrolls down, clear near bottom scrolls up.
|
- Currently 'buftype' is set to "popup", but all the specifics are on the
|
||||||
- Allow for setting scrollbar color: scrollbarhighlight,
|
window. Can we use a "normal" buffer and put the type on the window? (#4595)
|
||||||
scrollbarthumbhighlight ?
|
What if it's modified and the window closes?
|
||||||
|
- Add test for when popup with mask is off the left and off the right of the
|
||||||
|
screen.
|
||||||
|
- check padding/border when popup is off the left and right of the screen.
|
||||||
- Have a way to scroll to the bottom? (#4577)
|
- Have a way to scroll to the bottom? (#4577)
|
||||||
- Why does 'nrformats' leak from the popup window buffer???
|
- Why does 'nrformats' leak from the popup window buffer???
|
||||||
- Disable commands, feedkeys(), CTRL-W, etc. in a popup window.
|
- Disable commands, feedkeys(), CTRL-W, etc. in a popup window.
|
||||||
@@ -256,6 +259,8 @@ popup_getoptions({id}) *popup_getoptions()*
|
|||||||
zero. When all values are one then an empty list is included.
|
zero. When all values are one then an empty list is included.
|
||||||
|
|
||||||
"borderhighlight" is not included when all values are empty.
|
"borderhighlight" is not included when all values are empty.
|
||||||
|
"scrollbarhighlight" and "thumbhighlight" are onlu included
|
||||||
|
when set.
|
||||||
|
|
||||||
"tabpage" will be -1 for a global popup, zero for a popup on
|
"tabpage" will be -1 for a global popup, zero for a popup on
|
||||||
the current tabpage and a positive number for a popup on
|
the current tabpage and a positive number for a popup on
|
||||||
@@ -377,6 +382,8 @@ popup_setoptions({id}, {options}) *popup_setoptions()*
|
|||||||
borderhighlight
|
borderhighlight
|
||||||
borderchars
|
borderchars
|
||||||
scrollbar
|
scrollbar
|
||||||
|
scrollbarhighlight
|
||||||
|
thumbhighlight
|
||||||
zindex
|
zindex
|
||||||
mask
|
mask
|
||||||
time
|
time
|
||||||
@@ -534,6 +541,13 @@ The second argument of |popup_create()| is a dictionary with options:
|
|||||||
otherwise ASCII characters are used.
|
otherwise ASCII characters are used.
|
||||||
scrollbar non-zero: show a scrollbar when the text doesn't fit.
|
scrollbar non-zero: show a scrollbar when the text doesn't fit.
|
||||||
zero: do not show a scrollbar. Default is non-zero.
|
zero: do not show a scrollbar. Default is non-zero.
|
||||||
|
Also see |popup-scrollbar|.
|
||||||
|
scrollbarhighlight Highlight group name for the scrollbar. The
|
||||||
|
background color is what matters. When not given then
|
||||||
|
PmenuSbar is used.
|
||||||
|
thumbhighlight Highlight group name for the scrollbar thumb. The
|
||||||
|
background color is what matters. When not given then
|
||||||
|
PmenuThumb is used.
|
||||||
zindex Priority for the popup, default 50. Minimum value is
|
zindex Priority for the popup, default 50. Minimum value is
|
||||||
1, maximum value is 32000.
|
1, maximum value is 32000.
|
||||||
mask A list of lists with coordinates, defining parts of
|
mask A list of lists with coordinates, defining parts of
|
||||||
@@ -639,6 +653,17 @@ If the popup is force-closed, e.g. because the cursor moved or CTRL-C was
|
|||||||
pressed, the number -1 is passed to the callback.
|
pressed, the number -1 is passed to the callback.
|
||||||
|
|
||||||
|
|
||||||
|
POPUP SCROLLBAR *popup-scrollbar*
|
||||||
|
|
||||||
|
If the text does not fit in the popup a scrollbar is displayed on the right of
|
||||||
|
the window. This can be disabled by setting the "scrollbar" option to zero.
|
||||||
|
When the scrollbar is displayed mouse scroll events, while the mouse pointer
|
||||||
|
is on the popup, will cause the text to scroll up or down as you would expect.
|
||||||
|
A click in the upper halve of the scrollbar will scroll the text one line
|
||||||
|
down. A click in the lower halve wil scroll the text one line up. However,
|
||||||
|
this is limited so that the popup does not get smaller.
|
||||||
|
|
||||||
|
|
||||||
POPUP MASK *popup-mask*
|
POPUP MASK *popup-mask*
|
||||||
|
|
||||||
To minimize the text that the popup covers, parts of it can be made
|
To minimize the text that the popup covers, parts of it can be made
|
||||||
|
15
src/normal.c
15
src/normal.c
@@ -4561,20 +4561,7 @@ nv_mousescroll(cmdarg_T *cap)
|
|||||||
}
|
}
|
||||||
#ifdef FEAT_TEXT_PROP
|
#ifdef FEAT_TEXT_PROP
|
||||||
if (bt_popup(curwin->w_buffer))
|
if (bt_popup(curwin->w_buffer))
|
||||||
{
|
popup_set_firstline(curwin);
|
||||||
int height = curwin->w_height;
|
|
||||||
|
|
||||||
curwin->w_firstline = curwin->w_topline;
|
|
||||||
popup_adjust_position(curwin);
|
|
||||||
|
|
||||||
// we don't want the popup to get smaller, decrement the first line
|
|
||||||
// until it doesn't
|
|
||||||
while (curwin->w_firstline > 1 && curwin->w_height < height)
|
|
||||||
{
|
|
||||||
--curwin->w_firstline;
|
|
||||||
popup_adjust_position(curwin);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
# ifdef FEAT_GUI
|
# ifdef FEAT_GUI
|
||||||
|
@@ -234,6 +234,58 @@ popup_drag(win_T *wp)
|
|||||||
popup_adjust_position(wp);
|
popup_adjust_position(wp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set w_firstline to match the current "wp->w_topline".
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
popup_set_firstline(win_T *wp)
|
||||||
|
{
|
||||||
|
int height = wp->w_height;
|
||||||
|
|
||||||
|
wp->w_firstline = wp->w_topline;
|
||||||
|
popup_adjust_position(wp);
|
||||||
|
|
||||||
|
// we don't want the popup to get smaller, decrement the first line
|
||||||
|
// until it doesn't
|
||||||
|
while (wp->w_firstline > 1 && wp->w_height < height)
|
||||||
|
{
|
||||||
|
--wp->w_firstline;
|
||||||
|
popup_adjust_position(wp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Handle a click in a popup window, if it is in the scrollbar.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
popup_handle_scrollbar_click(win_T *wp, int row, int col)
|
||||||
|
{
|
||||||
|
int height = popup_height(wp);
|
||||||
|
int old_topline = wp->w_topline;
|
||||||
|
|
||||||
|
if (wp->w_has_scrollbar == 0)
|
||||||
|
return;
|
||||||
|
if (row >= wp->w_popup_border[0]
|
||||||
|
&& row < height - wp->w_popup_border[2]
|
||||||
|
&& col == popup_width(wp) - 1)
|
||||||
|
{
|
||||||
|
if (row >= height / 2)
|
||||||
|
{
|
||||||
|
// Click in lower half, scroll down.
|
||||||
|
if (wp->w_topline < wp->w_buffer->b_ml.ml_line_count)
|
||||||
|
++wp->w_topline;
|
||||||
|
}
|
||||||
|
else if (wp->w_topline > 1)
|
||||||
|
// click on upper half, scroll up.
|
||||||
|
--wp->w_topline;
|
||||||
|
if (wp->w_topline != old_topline)
|
||||||
|
{
|
||||||
|
popup_set_firstline(wp);
|
||||||
|
redraw_win_later(wp, NOT_VALID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(FEAT_TIMERS)
|
#if defined(FEAT_TIMERS)
|
||||||
static void
|
static void
|
||||||
popup_add_timeout(win_T *wp, int time)
|
popup_add_timeout(win_T *wp, int time)
|
||||||
@@ -631,7 +683,8 @@ popup_width(win_T *wp)
|
|||||||
{
|
{
|
||||||
return wp->w_width
|
return wp->w_width
|
||||||
+ wp->w_popup_padding[3] + wp->w_popup_border[3]
|
+ wp->w_popup_padding[3] + wp->w_popup_border[3]
|
||||||
+ wp->w_popup_padding[1] + wp->w_popup_border[1];
|
+ wp->w_popup_padding[1] + wp->w_popup_border[1]
|
||||||
|
+ wp->w_has_scrollbar;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -2,6 +2,8 @@
|
|||||||
int popup_on_border(win_T *wp, int row, int col);
|
int popup_on_border(win_T *wp, int row, int col);
|
||||||
void popup_start_drag(win_T *wp);
|
void popup_start_drag(win_T *wp);
|
||||||
void popup_drag(win_T *wp);
|
void popup_drag(win_T *wp);
|
||||||
|
void popup_set_firstline(win_T *wp);
|
||||||
|
void popup_handle_scrollbar_click(win_T *wp, int row, int col);
|
||||||
int popup_height(win_T *wp);
|
int popup_height(win_T *wp);
|
||||||
int popup_width(win_T *wp);
|
int popup_width(win_T *wp);
|
||||||
void popup_adjust_position(win_T *wp);
|
void popup_adjust_position(win_T *wp);
|
||||||
|
@@ -2903,7 +2903,7 @@ struct window_S
|
|||||||
int w_wantcol; // "col" for popup window
|
int w_wantcol; // "col" for popup window
|
||||||
int w_firstline; // "firstline" for popup window
|
int w_firstline; // "firstline" for popup window
|
||||||
int w_want_scrollbar; // when zero don't use a scrollbar
|
int w_want_scrollbar; // when zero don't use a scrollbar
|
||||||
int w_has_scrollbar; // scrollbar displayed
|
int w_has_scrollbar; // 1 if scrollbar displayed, 0 otherwise
|
||||||
char_u *w_scrollbar_highlight; // "scrollbarhighlight"
|
char_u *w_scrollbar_highlight; // "scrollbarhighlight"
|
||||||
char_u *w_thumb_highlight; // "thumbhighlight"
|
char_u *w_thumb_highlight; // "thumbhighlight"
|
||||||
int w_popup_padding[4]; // popup padding top/right/bot/left
|
int w_popup_padding[4]; // popup padding top/right/bot/left
|
||||||
|
10
src/testdir/dumps/Test_popupwin_scroll_8.dump
Normal file
10
src/testdir/dumps/Test_popupwin_scroll_8.dump
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
>1+0&#ffffff0| @73
|
||||||
|
|2| @73
|
||||||
|
|3| @73
|
||||||
|
|4| @31|f+0#0000001#ffd7ff255|o|u|r| @3| +0#0000000#ff404010| +0&#ffffff0@32
|
||||||
|
|5| @31|f+0#0000001#ffd7ff255|i|v|e| @3| +0#0000000#4040ff13| +0&#ffffff0@32
|
||||||
|
|6| @31|s+0#0000001#ffd7ff255|i|x| @4| +0#0000000#4040ff13| +0&#ffffff0@32
|
||||||
|
|7| @31|s+0#0000001#ffd7ff255|e|v|e|n| @2| +0#0000000#ff404010| +0&#ffffff0@32
|
||||||
|
|8| @73
|
||||||
|
|9| @73
|
||||||
|
|:|c|a|l@1| |C|l|i|c|k|T|o|p|(|)| @40|1|,|1| @10|T|o|p|
|
10
src/testdir/dumps/Test_popupwin_scroll_9.dump
Normal file
10
src/testdir/dumps/Test_popupwin_scroll_9.dump
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
>1+0&#ffffff0| @73
|
||||||
|
|2| @73
|
||||||
|
|3| @73
|
||||||
|
|4| @31|f+0#0000001#ffd7ff255|i|v|e| @3| +0#0000000#ff404010| +0&#ffffff0@32
|
||||||
|
|5| @31|s+0#0000001#ffd7ff255|i|x| @4| +0#0000000#ff404010| +0&#ffffff0@32
|
||||||
|
|6| @31|s+0#0000001#ffd7ff255|e|v|e|n| @2| +0#0000000#4040ff13| +0&#ffffff0@32
|
||||||
|
|7| @31|e+0#0000001#ffd7ff255|i|g|h|t| @2| +0#0000000#4040ff13| +0&#ffffff0@32
|
||||||
|
|8| @73
|
||||||
|
|9| @73
|
||||||
|
|:|c|a|l@1| |C|l|i|c|k|B|o|t|(|)| @40|1|,|1| @10|T|o|p|
|
@@ -1436,7 +1436,15 @@ func Test_popup_scrollbar()
|
|||||||
func ScrollDown()
|
func ScrollDown()
|
||||||
call feedkeys("\<F3>\<ScrollWheelDown>", "xt")
|
call feedkeys("\<F3>\<ScrollWheelDown>", "xt")
|
||||||
endfunc
|
endfunc
|
||||||
|
func ClickTop()
|
||||||
|
call feedkeys("\<F4>\<LeftMouse>", "xt")
|
||||||
|
endfunc
|
||||||
|
func ClickBot()
|
||||||
|
call feedkeys("\<F5>\<LeftMouse>", "xt")
|
||||||
|
endfunc
|
||||||
map <silent> <F3> :call test_setmouse(5, 36)<CR>
|
map <silent> <F3> :call test_setmouse(5, 36)<CR>
|
||||||
|
map <silent> <F4> :call test_setmouse(4, 42)<CR>
|
||||||
|
map <silent> <F5> :call test_setmouse(7, 42)<CR>
|
||||||
END
|
END
|
||||||
call writefile(lines, 'XtestPopupScroll')
|
call writefile(lines, 'XtestPopupScroll')
|
||||||
let buf = RunVimInTerminal('-S XtestPopupScroll', {'rows': 10})
|
let buf = RunVimInTerminal('-S XtestPopupScroll', {'rows': 10})
|
||||||
@@ -1464,6 +1472,14 @@ func Test_popup_scrollbar()
|
|||||||
call term_sendkeys(buf, ":call ScrollDown()\<CR>")
|
call term_sendkeys(buf, ":call ScrollDown()\<CR>")
|
||||||
call VerifyScreenDump(buf, 'Test_popupwin_scroll_7', {})
|
call VerifyScreenDump(buf, 'Test_popupwin_scroll_7', {})
|
||||||
|
|
||||||
|
call term_sendkeys(buf, ":call ClickTop()\<CR>")
|
||||||
|
sleep 100m
|
||||||
|
call term_sendkeys(buf, ":call ClickTop()\<CR>")
|
||||||
|
call VerifyScreenDump(buf, 'Test_popupwin_scroll_8', {})
|
||||||
|
|
||||||
|
call term_sendkeys(buf, ":call ClickBot()\<CR>")
|
||||||
|
call VerifyScreenDump(buf, 'Test_popupwin_scroll_9', {})
|
||||||
|
|
||||||
" clean up
|
" clean up
|
||||||
call StopVimInTerminal(buf)
|
call StopVimInTerminal(buf)
|
||||||
call delete('XtestPopupScroll')
|
call delete('XtestPopupScroll')
|
||||||
|
7
src/ui.c
7
src/ui.c
@@ -2998,7 +2998,7 @@ retnomove:
|
|||||||
return IN_OTHER_WIN;
|
return IN_OTHER_WIN;
|
||||||
#endif
|
#endif
|
||||||
#ifdef FEAT_TEXT_PROP
|
#ifdef FEAT_TEXT_PROP
|
||||||
// Continue a modeless selection in a popup window.
|
// Continue a modeless selection in a popup window or dragging it.
|
||||||
if (in_popup_win)
|
if (in_popup_win)
|
||||||
{
|
{
|
||||||
if (popup_dragwin != NULL)
|
if (popup_dragwin != NULL)
|
||||||
@@ -3056,6 +3056,9 @@ retnomove:
|
|||||||
popup_start_drag(wp);
|
popup_start_drag(wp);
|
||||||
return IN_UNKNOWN;
|
return IN_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
if (which_button == MOUSE_LEFT)
|
||||||
|
// If the click is in the scrollbar, may scroll up/down.
|
||||||
|
popup_handle_scrollbar_click(wp, row, col);
|
||||||
# ifdef FEAT_CLIPBOARD
|
# ifdef FEAT_CLIPBOARD
|
||||||
return IN_OTHER_WIN;
|
return IN_OTHER_WIN;
|
||||||
# else
|
# else
|
||||||
@@ -3517,7 +3520,7 @@ mouse_find_win(int *rowp, int *colp, mouse_find_T popup UNUSED)
|
|||||||
{
|
{
|
||||||
if (*rowp >= wp->w_winrow && *rowp < wp->w_winrow + popup_height(wp)
|
if (*rowp >= wp->w_winrow && *rowp < wp->w_winrow + popup_height(wp)
|
||||||
&& *colp >= wp->w_wincol
|
&& *colp >= wp->w_wincol
|
||||||
&& *colp < wp->w_wincol + popup_width(wp))
|
&& *colp < wp->w_wincol + popup_width(wp))
|
||||||
pwp = wp;
|
pwp = wp;
|
||||||
}
|
}
|
||||||
if (pwp != NULL)
|
if (pwp != NULL)
|
||||||
|
@@ -777,6 +777,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1607,
|
||||||
/**/
|
/**/
|
||||||
1606,
|
1606,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user