forked from aniani/vim
patch 9.1.0931: ml_get error in terminal buffer
Problem: ml_get error in terminal buffer (user202729) Solution: call update_topline() in win_enter_ext() for terminal buffers (h-east) fixes: #16024 closes: #16211 Signed-off-by: h-east <h.east.727@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
b34622579c
commit
3a3a2c921c
@@ -241,10 +241,54 @@ func Test_termwinscroll()
|
|||||||
let filtered = filter(copy(lines), {idx, val -> val =~ 'echo ' . i . '\>'})
|
let filtered = filter(copy(lines), {idx, val -> val =~ 'echo ' . i . '\>'})
|
||||||
call assert_equal(1, len(filtered), 'for "echo ' . i . '"')
|
call assert_equal(1, len(filtered), 'for "echo ' . i . '"')
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
exe buf . 'bwipe!'
|
exe buf . 'bwipe!'
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_termwinscroll_topline()
|
||||||
|
set termwinscroll=1000 mouse=a
|
||||||
|
terminal
|
||||||
|
call assert_equal(2, winnr('$'))
|
||||||
|
let buf = bufnr()
|
||||||
|
call WaitFor({-> !empty(term_getline(buf, 1))})
|
||||||
|
|
||||||
|
let num1 = &termwinscroll / 100 * 99
|
||||||
|
call writefile(range(num1), 'Xtext', 'D')
|
||||||
|
if has('win32')
|
||||||
|
call term_sendkeys(buf, "type Xtext\<CR>")
|
||||||
|
else
|
||||||
|
call term_sendkeys(buf, "cat Xtext\<CR>")
|
||||||
|
endif
|
||||||
|
let rows = term_getsize(buf)[0]
|
||||||
|
" On MS-Windows there is an empty line, check both last line and above it.
|
||||||
|
call WaitForAssert({-> assert_match(string(num1 - 1), term_getline(buf, rows - 1) .. term_getline(buf, rows - 2))})
|
||||||
|
call feedkeys("\<C-W>N", 'xt')
|
||||||
|
call feedkeys("i", 'xt')
|
||||||
|
|
||||||
|
let num2 = &termwinscroll / 100 * 10
|
||||||
|
call writefile(range(num2), 'Xtext', 'D')
|
||||||
|
if has('win32')
|
||||||
|
call term_sendkeys(buf, "timeout /t 1 && type Xtext\<CR>")
|
||||||
|
else
|
||||||
|
call term_sendkeys(buf, "sleep 1; cat Xtext\<CR>")
|
||||||
|
endif
|
||||||
|
" Change the normal window to the current window with keystrokes.
|
||||||
|
call feedkeys("\<C-W>w", 'xt')
|
||||||
|
call WaitForAssert({-> assert_notequal(buf, bufnr())})
|
||||||
|
let rows = term_getsize(buf)[0]
|
||||||
|
" On MS-Windows there is an empty line, check both last line and above it.
|
||||||
|
call WaitForAssert({-> assert_match(string(num2 - 1), term_getline(buf, rows - 1) .. term_getline(buf, rows - 2))})
|
||||||
|
" Change the terminal window to the current window using mouse operation.
|
||||||
|
call test_setmouse(1, 1)
|
||||||
|
call feedkeys("\<LeftMouse>", "xt")
|
||||||
|
call WaitForAssert({-> assert_equal(buf, bufnr())})
|
||||||
|
" Before the fix, E340 and E315 would occur multiple times at this point.
|
||||||
|
let wm = winheight(0) * 2
|
||||||
|
let num3 = num1 + num2 - (num1 / 10) - wm
|
||||||
|
call assert_inrange(num3 - wm, num3 + wm, getwininfo(bufwinid(buf))[0].topline)
|
||||||
|
exe buf . 'bwipe!'
|
||||||
|
set termwinscroll& mouse&
|
||||||
|
endfunc
|
||||||
|
|
||||||
" Resizing the terminal window caused an ml_get error.
|
" Resizing the terminal window caused an ml_get error.
|
||||||
" TODO: This does not reproduce the original problem.
|
" TODO: This does not reproduce the original problem.
|
||||||
" TODO: This test starts timing out in Github CI Gui test, why????
|
" TODO: This test starts timing out in Github CI Gui test, why????
|
||||||
|
@@ -704,6 +704,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 */
|
||||||
|
/**/
|
||||||
|
931,
|
||||||
/**/
|
/**/
|
||||||
930,
|
930,
|
||||||
/**/
|
/**/
|
||||||
|
@@ -5578,6 +5578,10 @@ win_enter_ext(win_T *wp, int flags)
|
|||||||
did_decrement = TRUE;
|
did_decrement = TRUE;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef FEAT_TERMINAL
|
||||||
|
if (bt_terminal(curwin->w_buffer))
|
||||||
|
update_topline();
|
||||||
|
#endif
|
||||||
|
|
||||||
win_fix_current_dir();
|
win_fix_current_dir();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user