vim-patch:9.0.1362: ml_get error when going to another tab (#22443)

Problem:    ml_get error when going to another tab. (Daniel J. Perry)
Solution:   Do not call update_topline() if "curwin" is invalid.
            (closes vim/vim#11907)

99ad3a8bb9

Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
zeertzjq 2023-02-28 08:26:00 +08:00 committed by GitHub
parent 2630341db6
commit 1b632e99f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 1 deletions

View File

@ -846,4 +846,19 @@ func Test_lastused_tabpage()
tabonly! tabonly!
endfunc endfunc
" this was giving ml_get errors
func Test_tabpage_last_line()
enew
call setline(1, repeat(['a'], &lines + 5))
$
tabnew
call setline(1, repeat(['b'], &lines + 20))
$
tabNext
call assert_equal('a', getline('.'))
bwipe!
bwipe!
endfunc
" vim: shiftwidth=2 sts=2 expandtab " vim: shiftwidth=2 sts=2 expandtab

View File

@ -4813,7 +4813,7 @@ static void win_enter_ext(win_T *const wp, const int flags)
// Might need to scroll the old window before switching, e.g., when the // Might need to scroll the old window before switching, e.g., when the
// cursor was moved. // cursor was moved.
if (*p_spk == 'c') { if (*p_spk == 'c' && !curwin_invalid) {
update_topline(curwin); update_topline(curwin);
} }