mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:9.0.1025: WinScrolled is not triggered when filler lines change (#21325)
Problem: WinScrolled is not triggered when filler lines change.
Solution: Add "topfill" to the values that WinScrolled triggers on.
(closes vim/vim#11668)
3fc84dc2c7
Cherry-pick StopVimInTerminal() from patch 9.0.1010.
This commit is contained in:
parent
f8aa2a0dea
commit
f92aab5f70
@ -631,9 +631,9 @@ The information provided by |WinScrolled| is a dictionary for each window that
|
|||||||
has changes, using the window ID as the key, and a total count of the changes
|
has changes, using the window ID as the key, and a total count of the changes
|
||||||
with the key "all". Example value for |v:event|:
|
with the key "all". Example value for |v:event|:
|
||||||
{
|
{
|
||||||
all: {width: 0, height: 2, leftcol: 0, topline: 1, skipcol: 0},
|
all: {width: 0, height: 2, leftcol: 0, skipcol: 0, topline: 1, topfill: 0},
|
||||||
1003: {width: 0, height: -1, leftcol: 0, topline: 0, skipcol: 0},
|
1003: {width: 0, height: -1, leftcol: 0, skipcol: 0, topline: 0, topfill: 0},
|
||||||
1006: {width: 0, height: 1, leftcol: 0, topline: 1, skipcol: 0},
|
1006: {width: 0, height: 1, leftcol: 0, skipcol: 0, topline: 1, topfill: 0},
|
||||||
}
|
}
|
||||||
|
|
||||||
Note that the "all" entry has the absolute values of the individual windows
|
Note that the "all" entry has the absolute values of the individual windows
|
||||||
|
@ -1193,6 +1193,7 @@ struct window_S {
|
|||||||
|
|
||||||
// five fields that are only used when there is a WinScrolled autocommand
|
// five fields that are only used when there is a WinScrolled autocommand
|
||||||
linenr_T w_last_topline; ///< last known value for w_topline
|
linenr_T w_last_topline; ///< last known value for w_topline
|
||||||
|
linenr_T w_last_topfill; ///< last known value for w_topfill
|
||||||
colnr_T w_last_leftcol; ///< last known value for w_leftcol
|
colnr_T w_last_leftcol; ///< last known value for w_leftcol
|
||||||
colnr_T w_last_skipcol; ///< last known value for w_skipcol
|
colnr_T w_last_skipcol; ///< last known value for w_skipcol
|
||||||
int w_last_width; ///< last known value for w_width
|
int w_last_width; ///< last known value for w_width
|
||||||
|
@ -382,8 +382,8 @@ func Test_WinScrolled()
|
|||||||
|
|
||||||
let event = readfile('XscrollEvent')[0]->json_decode()
|
let event = readfile('XscrollEvent')[0]->json_decode()
|
||||||
call assert_equal({
|
call assert_equal({
|
||||||
\ 'all': {'leftcol': 1, 'topline': 0, 'width': 0, 'height': 0, 'skipcol': 0},
|
\ 'all': {'leftcol': 1, 'topline': 0, 'topfill': 0, 'width': 0, 'height': 0, 'skipcol': 0},
|
||||||
\ '1000': {'leftcol': -1, 'topline': 0, 'width': 0, 'height': 0, 'skipcol': 0}
|
\ '1000': {'leftcol': -1, 'topline': 0, 'topfill': 0, 'width': 0, 'height': 0, 'skipcol': 0}
|
||||||
\ }, event)
|
\ }, event)
|
||||||
|
|
||||||
" Scroll up/down in Normal mode.
|
" Scroll up/down in Normal mode.
|
||||||
@ -392,8 +392,8 @@ func Test_WinScrolled()
|
|||||||
|
|
||||||
let event = readfile('XscrollEvent')[0]->json_decode()
|
let event = readfile('XscrollEvent')[0]->json_decode()
|
||||||
call assert_equal({
|
call assert_equal({
|
||||||
\ 'all': {'leftcol': 0, 'topline': 1, 'width': 0, 'height': 0, 'skipcol': 0},
|
\ 'all': {'leftcol': 0, 'topline': 1, 'topfill': 0, 'width': 0, 'height': 0, 'skipcol': 0},
|
||||||
\ '1000': {'leftcol': 0, 'topline': -1, 'width': 0, 'height': 0, 'skipcol': 0}
|
\ '1000': {'leftcol': 0, 'topline': -1, 'topfill': 0, 'width': 0, 'height': 0, 'skipcol': 0}
|
||||||
\ }, event)
|
\ }, event)
|
||||||
|
|
||||||
" Scroll up/down in Insert mode.
|
" Scroll up/down in Insert mode.
|
||||||
@ -403,8 +403,8 @@ func Test_WinScrolled()
|
|||||||
|
|
||||||
let event = readfile('XscrollEvent')[0]->json_decode()
|
let event = readfile('XscrollEvent')[0]->json_decode()
|
||||||
call assert_equal({
|
call assert_equal({
|
||||||
\ 'all': {'leftcol': 0, 'topline': 1, 'width': 0, 'height': 0, 'skipcol': 0},
|
\ 'all': {'leftcol': 0, 'topline': 1, 'topfill': 0, 'width': 0, 'height': 0, 'skipcol': 0},
|
||||||
\ '1000': {'leftcol': 0, 'topline': -1, 'width': 0, 'height': 0, 'skipcol': 0}
|
\ '1000': {'leftcol': 0, 'topline': -1, 'topfill': 0, 'width': 0, 'height': 0, 'skipcol': 0}
|
||||||
\ }, event)
|
\ }, event)
|
||||||
|
|
||||||
" Scroll the window horizontally to focus the last letter of the third line
|
" Scroll the window horizontally to focus the last letter of the third line
|
||||||
@ -416,8 +416,8 @@ func Test_WinScrolled()
|
|||||||
|
|
||||||
let event = readfile('XscrollEvent')[0]->json_decode()
|
let event = readfile('XscrollEvent')[0]->json_decode()
|
||||||
call assert_equal({
|
call assert_equal({
|
||||||
\ 'all': {'leftcol': 5, 'topline': 0, 'width': 0, 'height': 0, 'skipcol': 0},
|
\ 'all': {'leftcol': 5, 'topline': 0, 'topfill': 0, 'width': 0, 'height': 0, 'skipcol': 0},
|
||||||
\ '1000': {'leftcol': -5, 'topline': 0, 'width': 0, 'height': 0, 'skipcol': 0}
|
\ '1000': {'leftcol': -5, 'topline': 0, 'topfill': 0, 'width': 0, 'height': 0, 'skipcol': 0}
|
||||||
\ }, event)
|
\ }, event)
|
||||||
|
|
||||||
" Ensure the command was triggered for the specified window ID.
|
" Ensure the command was triggered for the specified window ID.
|
||||||
@ -567,6 +567,68 @@ func Test_WinScrolled_long_wrapped()
|
|||||||
call term_sendkeys(buf, '$')
|
call term_sendkeys(buf, '$')
|
||||||
call term_sendkeys(buf, ":echo g:scrolled\<CR>")
|
call term_sendkeys(buf, ":echo g:scrolled\<CR>")
|
||||||
call WaitForAssert({-> assert_match('^3 ', term_getline(buf, 6))}, 1000)
|
call WaitForAssert({-> assert_match('^3 ', term_getline(buf, 6))}, 1000)
|
||||||
|
|
||||||
|
call StopVimInTerminal(buf)
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
func Test_WinScrolled_diff()
|
||||||
|
CheckRunVimInTerminal
|
||||||
|
|
||||||
|
let lines =<< trim END
|
||||||
|
set diffopt+=foldcolumn:0
|
||||||
|
call setline(1, ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'])
|
||||||
|
vnew
|
||||||
|
call setline(1, ['d', 'e', 'f', 'g', 'h', 'i'])
|
||||||
|
windo diffthis
|
||||||
|
func WriteScrollEvent()
|
||||||
|
call writefile([json_encode(v:event)], 'XscrollEvent')
|
||||||
|
endfunc
|
||||||
|
au WinScrolled * call WriteScrollEvent()
|
||||||
|
END
|
||||||
|
call writefile(lines, 'Xtest_winscrolled_diff', 'D')
|
||||||
|
let buf = RunVimInTerminal('-S Xtest_winscrolled_diff', {'rows': 8})
|
||||||
|
|
||||||
|
call term_sendkeys(buf, "\<C-E>")
|
||||||
|
call WaitForAssert({-> assert_match('^d', term_getline(buf, 3))}, 1000)
|
||||||
|
|
||||||
|
let event = readfile('XscrollEvent')[0]->json_decode()
|
||||||
|
call assert_equal({
|
||||||
|
\ 'all': {'leftcol': 0, 'topline': 1, 'topfill': 1, 'width': 0, 'height': 0, 'skipcol': 0},
|
||||||
|
\ '1000': {'leftcol': 0, 'topline': 1, 'topfill': 0, 'width': 0, 'height': 0, 'skipcol': 0},
|
||||||
|
\ '1001': {'leftcol': 0, 'topline': 0, 'topfill': -1, 'width': 0, 'height': 0, 'skipcol': 0}
|
||||||
|
\ }, event)
|
||||||
|
|
||||||
|
call term_sendkeys(buf, "2\<C-E>")
|
||||||
|
call WaitForAssert({-> assert_match('^f', term_getline(buf, 3))}, 1000)
|
||||||
|
|
||||||
|
let event = readfile('XscrollEvent')[0]->json_decode()
|
||||||
|
call assert_equal({
|
||||||
|
\ 'all': {'leftcol': 0, 'topline': 2, 'topfill': 2, 'width': 0, 'height': 0, 'skipcol': 0},
|
||||||
|
\ '1000': {'leftcol': 0, 'topline': 2, 'topfill': 0, 'width': 0, 'height': 0, 'skipcol': 0},
|
||||||
|
\ '1001': {'leftcol': 0, 'topline': 0, 'topfill': -2, 'width': 0, 'height': 0, 'skipcol': 0}
|
||||||
|
\ }, event)
|
||||||
|
|
||||||
|
call term_sendkeys(buf, "\<C-E>")
|
||||||
|
call WaitForAssert({-> assert_match('^g', term_getline(buf, 3))}, 1000)
|
||||||
|
|
||||||
|
let event = readfile('XscrollEvent')[0]->json_decode()
|
||||||
|
call assert_equal({
|
||||||
|
\ 'all': {'leftcol': 0, 'topline': 2, 'topfill': 0, 'width': 0, 'height': 0, 'skipcol': 0},
|
||||||
|
\ '1000': {'leftcol': 0, 'topline': 1, 'topfill': 0, 'width': 0, 'height': 0, 'skipcol': 0},
|
||||||
|
\ '1001': {'leftcol': 0, 'topline': 1, 'topfill': 0, 'width': 0, 'height': 0, 'skipcol': 0}
|
||||||
|
\ }, event)
|
||||||
|
|
||||||
|
call term_sendkeys(buf, "2\<C-Y>")
|
||||||
|
call WaitForAssert({-> assert_match('^e', term_getline(buf, 3))}, 1000)
|
||||||
|
|
||||||
|
let event = readfile('XscrollEvent')[0]->json_decode()
|
||||||
|
call assert_equal({
|
||||||
|
\ 'all': {'leftcol': 0, 'topline': 3, 'topfill': 1, 'width': 0, 'height': 0, 'skipcol': 0},
|
||||||
|
\ '1000': {'leftcol': 0, 'topline': -2, 'topfill': 0, 'width': 0, 'height': 0, 'skipcol': 0},
|
||||||
|
\ '1001': {'leftcol': 0, 'topline': -1, 'topfill': 1, 'width': 0, 'height': 0, 'skipcol': 0}
|
||||||
|
\ }, event)
|
||||||
|
|
||||||
|
call StopVimInTerminal(buf)
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_WinClosed()
|
func Test_WinClosed()
|
||||||
|
@ -5306,6 +5306,7 @@ void snapshot_windows_scroll_size(void)
|
|||||||
{
|
{
|
||||||
FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
|
FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
|
||||||
wp->w_last_topline = wp->w_topline;
|
wp->w_last_topline = wp->w_topline;
|
||||||
|
wp->w_last_topfill = wp->w_topfill;
|
||||||
wp->w_last_leftcol = wp->w_leftcol;
|
wp->w_last_leftcol = wp->w_leftcol;
|
||||||
wp->w_last_skipcol = wp->w_skipcol;
|
wp->w_last_skipcol = wp->w_skipcol;
|
||||||
wp->w_last_width = wp->w_width;
|
wp->w_last_width = wp->w_width;
|
||||||
@ -5327,7 +5328,8 @@ void may_make_initial_scroll_size_snapshot(void)
|
|||||||
/// window.
|
/// window.
|
||||||
/// Returns the dictionary with refcount set to one.
|
/// Returns the dictionary with refcount set to one.
|
||||||
/// Returns NULL on internal error.
|
/// Returns NULL on internal error.
|
||||||
static dict_T *make_win_info_dict(int width, int height, int topline, int leftcol, int skipcol)
|
static dict_T *make_win_info_dict(int width, int height, int topline, int topfill, int leftcol,
|
||||||
|
int skipcol)
|
||||||
{
|
{
|
||||||
dict_T *const d = tv_dict_alloc();
|
dict_T *const d = tv_dict_alloc();
|
||||||
d->dv_refcount = 1;
|
d->dv_refcount = 1;
|
||||||
@ -5351,6 +5353,10 @@ static dict_T *make_win_info_dict(int width, int height, int topline, int leftco
|
|||||||
if (tv_dict_add_tv(d, S_LEN("topline"), &tv) == FAIL) {
|
if (tv_dict_add_tv(d, S_LEN("topline"), &tv) == FAIL) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
tv.vval.v_number = topfill;
|
||||||
|
if (tv_dict_add_tv(d, S_LEN("topfill"), &tv) == FAIL) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
tv.vval.v_number = leftcol;
|
tv.vval.v_number = leftcol;
|
||||||
if (tv_dict_add_tv(d, S_LEN("leftcol"), &tv) == FAIL) {
|
if (tv_dict_add_tv(d, S_LEN("leftcol"), &tv) == FAIL) {
|
||||||
break;
|
break;
|
||||||
@ -5394,6 +5400,7 @@ static int check_window_scroll_resize(int *size_count, win_T **first_scroll_win,
|
|||||||
int tot_width = 0;
|
int tot_width = 0;
|
||||||
int tot_height = 0;
|
int tot_height = 0;
|
||||||
int tot_topline = 0;
|
int tot_topline = 0;
|
||||||
|
int tot_topfill = 0;
|
||||||
int tot_leftcol = 0;
|
int tot_leftcol = 0;
|
||||||
int tot_skipcol = 0;
|
int tot_skipcol = 0;
|
||||||
|
|
||||||
@ -5426,6 +5433,7 @@ static int check_window_scroll_resize(int *size_count, win_T **first_scroll_win,
|
|||||||
}
|
}
|
||||||
|
|
||||||
const bool scroll_changed = wp->w_last_topline != wp->w_topline
|
const bool scroll_changed = wp->w_last_topline != wp->w_topline
|
||||||
|
|| wp->w_last_topfill != wp->w_topfill
|
||||||
|| wp->w_last_leftcol != wp->w_leftcol
|
|| wp->w_last_leftcol != wp->w_leftcol
|
||||||
|| wp->w_last_skipcol != wp->w_skipcol;
|
|| wp->w_last_skipcol != wp->w_skipcol;
|
||||||
if (scroll_changed) {
|
if (scroll_changed) {
|
||||||
@ -5440,10 +5448,11 @@ static int check_window_scroll_resize(int *size_count, win_T **first_scroll_win,
|
|||||||
int width = wp->w_width - wp->w_last_width;
|
int width = wp->w_width - wp->w_last_width;
|
||||||
int height = wp->w_height - wp->w_last_height;
|
int height = wp->w_height - wp->w_last_height;
|
||||||
int topline = wp->w_topline - wp->w_last_topline;
|
int topline = wp->w_topline - wp->w_last_topline;
|
||||||
|
int topfill = wp->w_topfill - wp->w_last_topfill;
|
||||||
int leftcol = wp->w_leftcol - wp->w_last_leftcol;
|
int leftcol = wp->w_leftcol - wp->w_last_leftcol;
|
||||||
int skipcol = wp->w_skipcol - wp->w_last_skipcol;
|
int skipcol = wp->w_skipcol - wp->w_last_skipcol;
|
||||||
dict_T *d = make_win_info_dict(width, height,
|
dict_T *d = make_win_info_dict(width, height, topline,
|
||||||
topline, leftcol, skipcol);
|
topfill, leftcol, skipcol);
|
||||||
if (d == NULL) {
|
if (d == NULL) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -5458,14 +5467,15 @@ static int check_window_scroll_resize(int *size_count, win_T **first_scroll_win,
|
|||||||
tot_width += abs(width);
|
tot_width += abs(width);
|
||||||
tot_height += abs(height);
|
tot_height += abs(height);
|
||||||
tot_topline += abs(topline);
|
tot_topline += abs(topline);
|
||||||
|
tot_topfill += abs(topfill);
|
||||||
tot_leftcol += abs(leftcol);
|
tot_leftcol += abs(leftcol);
|
||||||
tot_skipcol += abs(skipcol);
|
tot_skipcol += abs(skipcol);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (v_event != NULL) {
|
if (v_event != NULL) {
|
||||||
dict_T *alldict = make_win_info_dict(tot_width, tot_height,
|
dict_T *alldict = make_win_info_dict(tot_width, tot_height, tot_topline,
|
||||||
tot_topline, tot_leftcol, tot_skipcol);
|
tot_topfill, tot_leftcol, tot_skipcol);
|
||||||
if (alldict != NULL) {
|
if (alldict != NULL) {
|
||||||
if (tv_dict_add_dict(v_event, S_LEN("all"), alldict) == FAIL) {
|
if (tv_dict_add_dict(v_event, S_LEN("all"), alldict) == FAIL) {
|
||||||
tv_dict_unref(alldict);
|
tv_dict_unref(alldict);
|
||||||
|
@ -70,15 +70,15 @@ describe('WinScrolled', function()
|
|||||||
feed('<C-E>')
|
feed('<C-E>')
|
||||||
eq(1, eval('g:scrolled'))
|
eq(1, eval('g:scrolled'))
|
||||||
eq({
|
eq({
|
||||||
all = {leftcol = 0, topline = 1, width = 0, height = 0, skipcol = 0},
|
all = {leftcol = 0, topline = 1, topfill = 0, width = 0, height = 0, skipcol = 0},
|
||||||
['1000'] = {leftcol = 0, topline = 1, width = 0, height = 0, skipcol = 0},
|
['1000'] = {leftcol = 0, topline = 1, topfill = 0, width = 0, height = 0, skipcol = 0},
|
||||||
}, eval('g:v_event'))
|
}, eval('g:v_event'))
|
||||||
|
|
||||||
feed('<C-Y>')
|
feed('<C-Y>')
|
||||||
eq(2, eval('g:scrolled'))
|
eq(2, eval('g:scrolled'))
|
||||||
eq({
|
eq({
|
||||||
all = {leftcol = 0, topline = 1, width = 0, height = 0, skipcol = 0},
|
all = {leftcol = 0, topline = 1, topfill = 0, width = 0, height = 0, skipcol = 0},
|
||||||
['1000'] = {leftcol = 0, topline = -1, width = 0, height = 0, skipcol = 0},
|
['1000'] = {leftcol = 0, topline = -1, topfill = 0, width = 0, height = 0, skipcol = 0},
|
||||||
}, eval('g:v_event'))
|
}, eval('g:v_event'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@ -93,15 +93,15 @@ describe('WinScrolled', function()
|
|||||||
feed('zl')
|
feed('zl')
|
||||||
eq(1, eval('g:scrolled'))
|
eq(1, eval('g:scrolled'))
|
||||||
eq({
|
eq({
|
||||||
all = {leftcol = 1, topline = 0, width = 0, height = 0, skipcol = 0},
|
all = {leftcol = 1, topline = 0, topfill = 0, width = 0, height = 0, skipcol = 0},
|
||||||
['1000'] = {leftcol = 1, topline = 0, width = 0, height = 0, skipcol = 0},
|
['1000'] = {leftcol = 1, topline = 0, topfill = 0, width = 0, height = 0, skipcol = 0},
|
||||||
}, eval('g:v_event'))
|
}, eval('g:v_event'))
|
||||||
|
|
||||||
feed('zh')
|
feed('zh')
|
||||||
eq(2, eval('g:scrolled'))
|
eq(2, eval('g:scrolled'))
|
||||||
eq({
|
eq({
|
||||||
all = {leftcol = 1, topline = 0, width = 0, height = 0, skipcol = 0},
|
all = {leftcol = 1, topline = 0, topfill = 0, width = 0, height = 0, skipcol = 0},
|
||||||
['1000'] = {leftcol = -1, topline = 0, width = 0, height = 0, skipcol = 0},
|
['1000'] = {leftcol = -1, topline = 0, topfill = 0, width = 0, height = 0, skipcol = 0},
|
||||||
}, eval('g:v_event'))
|
}, eval('g:v_event'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@ -115,29 +115,29 @@ describe('WinScrolled', function()
|
|||||||
feed('zl')
|
feed('zl')
|
||||||
eq(1, eval('g:scrolled'))
|
eq(1, eval('g:scrolled'))
|
||||||
eq({
|
eq({
|
||||||
all = {leftcol = 1, topline = 0, width = 0, height = 0, skipcol = 0},
|
all = {leftcol = 1, topline = 0, topfill = 0, width = 0, height = 0, skipcol = 0},
|
||||||
['1000'] = {leftcol = 1, topline = 0, width = 0, height = 0, skipcol = 0},
|
['1000'] = {leftcol = 1, topline = 0, topfill = 0, width = 0, height = 0, skipcol = 0},
|
||||||
}, eval('g:v_event'))
|
}, eval('g:v_event'))
|
||||||
|
|
||||||
feed('zl')
|
feed('zl')
|
||||||
eq(2, eval('g:scrolled'))
|
eq(2, eval('g:scrolled'))
|
||||||
eq({
|
eq({
|
||||||
all = {leftcol = 1, topline = 0, width = 0, height = 0, skipcol = 0},
|
all = {leftcol = 1, topline = 0, topfill = 0, width = 0, height = 0, skipcol = 0},
|
||||||
['1000'] = {leftcol = 1, topline = 0, width = 0, height = 0, skipcol = 0},
|
['1000'] = {leftcol = 1, topline = 0, topfill = 0, width = 0, height = 0, skipcol = 0},
|
||||||
}, eval('g:v_event'))
|
}, eval('g:v_event'))
|
||||||
|
|
||||||
feed('h')
|
feed('h')
|
||||||
eq(3, eval('g:scrolled'))
|
eq(3, eval('g:scrolled'))
|
||||||
eq({
|
eq({
|
||||||
all = {leftcol = 1, topline = 0, width = 0, height = 0, skipcol = 0},
|
all = {leftcol = 1, topline = 0, topfill = 0, width = 0, height = 0, skipcol = 0},
|
||||||
['1000'] = {leftcol = -1, topline = 0, width = 0, height = 0, skipcol = 0},
|
['1000'] = {leftcol = -1, topline = 0, topfill = 0, width = 0, height = 0, skipcol = 0},
|
||||||
}, eval('g:v_event'))
|
}, eval('g:v_event'))
|
||||||
|
|
||||||
feed('zh')
|
feed('zh')
|
||||||
eq(4, eval('g:scrolled'))
|
eq(4, eval('g:scrolled'))
|
||||||
eq({
|
eq({
|
||||||
all = {leftcol = 1, topline = 0, width = 0, height = 0, skipcol = 0},
|
all = {leftcol = 1, topline = 0, topfill = 0, width = 0, height = 0, skipcol = 0},
|
||||||
['1000'] = {leftcol = -1, topline = 0, width = 0, height = 0, skipcol = 0},
|
['1000'] = {leftcol = -1, topline = 0, topfill = 0, width = 0, height = 0, skipcol = 0},
|
||||||
}, eval('g:v_event'))
|
}, eval('g:v_event'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@ -152,15 +152,15 @@ describe('WinScrolled', function()
|
|||||||
feed('gj')
|
feed('gj')
|
||||||
eq(1, eval('g:scrolled'))
|
eq(1, eval('g:scrolled'))
|
||||||
eq({
|
eq({
|
||||||
all = {leftcol = 0, topline = 0, width = 0, height = 0, skipcol = width},
|
all = {leftcol = 0, topline = 0, topfill = 0, width = 0, height = 0, skipcol = width},
|
||||||
['1000'] = {leftcol = 0, topline = 0, width = 0, height = 0, skipcol = width},
|
['1000'] = {leftcol = 0, topline = 0, topfill = 0, width = 0, height = 0, skipcol = width},
|
||||||
}, eval('g:v_event'))
|
}, eval('g:v_event'))
|
||||||
|
|
||||||
feed('0')
|
feed('0')
|
||||||
eq(2, eval('g:scrolled'))
|
eq(2, eval('g:scrolled'))
|
||||||
eq({
|
eq({
|
||||||
all = {leftcol = 0, topline = 0, width = 0, height = 0, skipcol = width},
|
all = {leftcol = 0, topline = 0, topfill = 0, width = 0, height = 0, skipcol = width},
|
||||||
['1000'] = {leftcol = 0, topline = 0, width = 0, height = 0, skipcol = -width},
|
['1000'] = {leftcol = 0, topline = 0, topfill = 0, width = 0, height = 0, skipcol = -width},
|
||||||
}, eval('g:v_event'))
|
}, eval('g:v_event'))
|
||||||
|
|
||||||
feed('$')
|
feed('$')
|
||||||
@ -181,15 +181,15 @@ describe('WinScrolled', function()
|
|||||||
feed('i<C-X><C-E><Esc>')
|
feed('i<C-X><C-E><Esc>')
|
||||||
eq(1, eval('g:scrolled'))
|
eq(1, eval('g:scrolled'))
|
||||||
eq({
|
eq({
|
||||||
all = {leftcol = 0, topline = 1, width = 0, height = 0, skipcol = 0},
|
all = {leftcol = 0, topline = 1, topfill = 0, width = 0, height = 0, skipcol = 0},
|
||||||
['1000'] = {leftcol = 0, topline = 1, width = 0, height = 0, skipcol = 0},
|
['1000'] = {leftcol = 0, topline = 1, topfill = 0, width = 0, height = 0, skipcol = 0},
|
||||||
}, eval('g:v_event'))
|
}, eval('g:v_event'))
|
||||||
|
|
||||||
feed('i<C-X><C-Y><Esc>')
|
feed('i<C-X><C-Y><Esc>')
|
||||||
eq(2, eval('g:scrolled'))
|
eq(2, eval('g:scrolled'))
|
||||||
eq({
|
eq({
|
||||||
all = {leftcol = 0, topline = 1, width = 0, height = 0, skipcol = 0},
|
all = {leftcol = 0, topline = 1, topfill = 0, width = 0, height = 0, skipcol = 0},
|
||||||
['1000'] = {leftcol = 0, topline = -1, width = 0, height = 0, skipcol = 0},
|
['1000'] = {leftcol = 0, topline = -1, topfill = 0, width = 0, height = 0, skipcol = 0},
|
||||||
}, eval('g:v_event'))
|
}, eval('g:v_event'))
|
||||||
|
|
||||||
feed('L')
|
feed('L')
|
||||||
@ -198,8 +198,8 @@ describe('WinScrolled', function()
|
|||||||
feed('A<CR><Esc>')
|
feed('A<CR><Esc>')
|
||||||
eq(3, eval('g:scrolled'))
|
eq(3, eval('g:scrolled'))
|
||||||
eq({
|
eq({
|
||||||
all = {leftcol = 0, topline = 1, width = 0, height = 0, skipcol = 0},
|
all = {leftcol = 0, topline = 1, topfill = 0, width = 0, height = 0, skipcol = 0},
|
||||||
['1000'] = {leftcol = 0, topline = 1, width = 0, height = 0, skipcol = 0},
|
['1000'] = {leftcol = 0, topline = 1, topfill = 0, width = 0, height = 0, skipcol = 0},
|
||||||
}, eval('g:v_event'))
|
}, eval('g:v_event'))
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
@ -244,6 +244,46 @@ describe('WinScrolled', function()
|
|||||||
assert_alive()
|
assert_alive()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
-- oldtest: Test_WinScrolled_diff()
|
||||||
|
it('is triggered for both windows when scrolling in diff mode', function()
|
||||||
|
exec([[
|
||||||
|
set diffopt+=foldcolumn:0
|
||||||
|
call setline(1, ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'])
|
||||||
|
vnew
|
||||||
|
call setline(1, ['d', 'e', 'f', 'g', 'h', 'i'])
|
||||||
|
windo diffthis
|
||||||
|
au WinScrolled * let g:v_event = deepcopy(v:event)
|
||||||
|
]])
|
||||||
|
|
||||||
|
feed('<C-E>')
|
||||||
|
eq({
|
||||||
|
all = {leftcol = 0, topline = 1, topfill = 1, width = 0, height = 0, skipcol = 0},
|
||||||
|
['1000'] = {leftcol = 0, topline = 1, topfill = 0, width = 0, height = 0, skipcol = 0},
|
||||||
|
['1001'] = {leftcol = 0, topline = 0, topfill = -1, width = 0, height = 0, skipcol = 0},
|
||||||
|
}, eval('g:v_event'))
|
||||||
|
|
||||||
|
feed('2<C-E>')
|
||||||
|
eq({
|
||||||
|
all = {leftcol = 0, topline = 2, topfill = 2, width = 0, height = 0, skipcol = 0},
|
||||||
|
['1000'] = {leftcol = 0, topline = 2, topfill = 0, width = 0, height = 0, skipcol = 0},
|
||||||
|
['1001'] = {leftcol = 0, topline = 0, topfill = -2, width = 0, height = 0, skipcol = 0},
|
||||||
|
}, eval('g:v_event'))
|
||||||
|
|
||||||
|
feed('<C-E>')
|
||||||
|
eq({
|
||||||
|
all = {leftcol = 0, topline = 2, topfill = 0, width = 0, height = 0, skipcol = 0},
|
||||||
|
['1000'] = {leftcol = 0, topline = 1, topfill = 0, width = 0, height = 0, skipcol = 0},
|
||||||
|
['1001'] = {leftcol = 0, topline = 1, topfill = 0, width = 0, height = 0, skipcol = 0},
|
||||||
|
}, eval('g:v_event'))
|
||||||
|
|
||||||
|
feed('2<C-Y>')
|
||||||
|
eq({
|
||||||
|
all = {leftcol = 0, topline = 3, topfill = 1, width = 0, height = 0, skipcol = 0},
|
||||||
|
['1000'] = {leftcol = 0, topline = -2, topfill = 0, width = 0, height = 0, skipcol = 0},
|
||||||
|
['1001'] = {leftcol = 0, topline = -1, topfill = 1, width = 0, height = 0, skipcol = 0},
|
||||||
|
}, eval('g:v_event'))
|
||||||
|
end)
|
||||||
|
|
||||||
it('is triggered by mouse scrolling in unfocused floating window #18222', function()
|
it('is triggered by mouse scrolling in unfocused floating window #18222', function()
|
||||||
local screen = Screen.new(80, 24)
|
local screen = Screen.new(80, 24)
|
||||||
screen:attach()
|
screen:attach()
|
||||||
@ -270,16 +310,16 @@ describe('WinScrolled', function()
|
|||||||
eq(1, eval('g:scrolled'))
|
eq(1, eval('g:scrolled'))
|
||||||
eq(winid_str, eval('g:amatch'))
|
eq(winid_str, eval('g:amatch'))
|
||||||
eq({
|
eq({
|
||||||
all = {leftcol = 0, topline = 3, width = 0, height = 0, skipcol = 0},
|
all = {leftcol = 0, topline = 3, topfill = 0, width = 0, height = 0, skipcol = 0},
|
||||||
[winid_str] = {leftcol = 0, topline = 3, width = 0, height = 0, skipcol = 0},
|
[winid_str] = {leftcol = 0, topline = 3, topfill = 0, width = 0, height = 0, skipcol = 0},
|
||||||
}, eval('g:v_event'))
|
}, eval('g:v_event'))
|
||||||
|
|
||||||
meths.input_mouse('wheel', 'up', '', 0, 3, 3)
|
meths.input_mouse('wheel', 'up', '', 0, 3, 3)
|
||||||
eq(2, eval('g:scrolled'))
|
eq(2, eval('g:scrolled'))
|
||||||
eq(tostring(win.id), eval('g:amatch'))
|
eq(tostring(win.id), eval('g:amatch'))
|
||||||
eq({
|
eq({
|
||||||
all = {leftcol = 0, topline = 3, width = 0, height = 0, skipcol = 0},
|
all = {leftcol = 0, topline = 3, topfill = 0, width = 0, height = 0, skipcol = 0},
|
||||||
[winid_str] = {leftcol = 0, topline = -3, width = 0, height = 0, skipcol = 0},
|
[winid_str] = {leftcol = 0, topline = -3, topfill = 0, width = 0, height = 0, skipcol = 0},
|
||||||
}, eval('g:v_event'))
|
}, eval('g:v_event'))
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
Loading…
Reference in New Issue
Block a user