vim-patch:8.2.1947: crash when using "zj" without folds (#13222)

Problem:    Crash when using "zj" without folds. (Sean Dewar)
Solution:   Check for at least one fold. (closes vim/vim#7245)
c136a3528b
This commit is contained in:
Sean Dewar
2020-11-04 03:44:08 +00:00
committed by GitHub
parent eee0668818
commit aaaad0f593
2 changed files with 14 additions and 0 deletions

View File

@@ -888,6 +888,9 @@ int foldMoveTo(
// that moves the cursor is used.
linenr_T lnum_off = 0;
garray_T *gap = &curwin->w_folds;
if (gap->ga_len == 0) {
break;
}
bool use_level = false;
bool maybe_small = false;
linenr_T lnum_found = curwin->w_cursor.lnum;

View File

@@ -795,3 +795,14 @@ func Test_fold_delete_first_line()
bwipe!
set foldmethod&
endfunc
" this was crashing
func Test_move_no_folds()
new
fold
setlocal fdm=expr
normal zj
bwipe!
endfunc
" vim: shiftwidth=2 sts=2 expandtab