1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
|
local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local clear = helpers.clear
local exec = helpers.exec
local exec_lua = helpers.exec_lua
local feed = helpers.feed
describe('splitkeep', function()
local screen = Screen.new()
before_each(function()
clear('--cmd', 'set splitkeep=screen')
screen:attach()
end)
-- oldtest: Test_splitkeep_callback()
it('does not scroll when split in callback', function()
exec([[
call setline(1, range(&lines))
function C1(a, b, c)
split | wincmd p
endfunction
function C2(a, b, c)
close | split
endfunction
]])
exec_lua([[
vim.api.nvim_set_keymap("n", "j", "", { callback = function()
vim.cmd("call jobstart([&sh, &shcf, 'true'], { 'on_exit': 'C1' })")
end
})]])
exec_lua([[
vim.api.nvim_set_keymap("n", "t", "", { callback = function()
vim.api.nvim_set_current_win(
vim.api.nvim_open_win(vim.api.nvim_create_buf(false, {}), false, {
width = 10,
relative = "cursor",
height = 4,
row = 0,
col = 0,
}))
vim.cmd("call termopen([&sh, &shcf, 'true'], { 'on_exit': 'C2' })")
end
})]])
feed('j')
screen:expect([[
0 |
1 |
2 |
3 |
4 |
5 |
[No Name] [+] |
^7 |
8 |
9 |
10 |
11 |
[No Name] [+] |
|
]])
feed(':quit<CR>Ht')
screen:expect([[
^0 |
1 |
2 |
3 |
4 |
5 |
[No Name] [+] |
7 |
8 |
9 |
10 |
11 |
[No Name] [+] |
:quit |
]])
feed(':set sb<CR>:quit<CR>Gj')
screen:expect([[
1 |
2 |
3 |
4 |
^5 |
[No Name] [+] |
7 |
8 |
9 |
10 |
11 |
12 |
[No Name] [+] |
:quit |
]])
feed(':quit<CR>Gt')
screen:expect([[
1 |
2 |
3 |
4 |
5 |
[No Name] [+] |
7 |
8 |
9 |
10 |
11 |
^12 |
[No Name] [+] |
:quit |
]])
end)
-- oldtest: Test_splitkeep_fold()
it('does not scroll when window has closed folds', function()
exec([[
set splitkeep=screen
set foldmethod=marker
set number
let line = 1
for n in range(1, &lines)
call setline(line, ['int FuncName() {/*{{{*/', 1, 2, 3, 4, 5, '}/*}}}*/',
\ 'after fold'])
let line += 8
endfor
]])
feed('L:wincmd s<CR>')
screen:expect([[
1 +-- 7 lines: int FuncName() {···················|
8 after fold |
9 +-- 7 lines: int FuncName() {···················|
16 after fold |
17 +-- 7 lines: int FuncName() {···················|
24 ^after fold |
[No Name] [+] |
32 after fold |
33 +-- 7 lines: int FuncName() {···················|
40 after fold |
41 +-- 7 lines: int FuncName() {···················|
48 after fold |
[No Name] [+] |
:wincmd s |
]])
feed(':quit<CR>')
screen:expect([[
1 +-- 7 lines: int FuncName() {···················|
8 after fold |
9 +-- 7 lines: int FuncName() {···················|
16 after fold |
17 +-- 7 lines: int FuncName() {···················|
24 after fold |
25 +-- 7 lines: int FuncName() {···················|
32 after fold |
33 +-- 7 lines: int FuncName() {···················|
40 after fold |
41 +-- 7 lines: int FuncName() {···················|
48 after fold |
49 ^+-- 7 lines: int FuncName() {···················|
:quit |
]])
feed('H:below split<CR>')
screen:expect([[
1 +-- 7 lines: int FuncName() {···················|
8 after fold |
9 +-- 7 lines: int FuncName() {···················|
16 after fold |
17 +-- 7 lines: int FuncName() {···················|
[No Name] [+] |
25 ^+-- 7 lines: int FuncName() {···················|
32 after fold |
33 +-- 7 lines: int FuncName() {···················|
40 after fold |
41 +-- 7 lines: int FuncName() {···················|
48 after fold |
[No Name] [+] |
:below split |
]])
feed(':wincmd k<CR>:quit<CR>')
screen:expect([[
1 +-- 7 lines: int FuncName() {···················|
8 after fold |
9 +-- 7 lines: int FuncName() {···················|
16 after fold |
17 +-- 7 lines: int FuncName() {···················|
24 after fold |
25 ^+-- 7 lines: int FuncName() {···················|
32 after fold |
33 +-- 7 lines: int FuncName() {···················|
40 after fold |
41 +-- 7 lines: int FuncName() {···················|
48 after fold |
49 +-- 7 lines: int FuncName() {···················|
:quit |
]])
end)
end)
|