ex_cmds.c: Fix bug in ex_z (#6557)

vim-patch:8.0.0571
This commit is contained in:
sander2
2017-04-21 15:45:51 +02:00
committed by Justin M. Keyes
parent a396874da0
commit f50e03f2e3
2 changed files with 21 additions and 3 deletions

View File

@@ -2877,8 +2877,11 @@ void ex_z(exarg_T *eap)
if (end > curbuf->b_ml.ml_line_count)
end = curbuf->b_ml.ml_line_count;
if (curs > curbuf->b_ml.ml_line_count)
if (curs > curbuf->b_ml.ml_line_count) {
curs = curbuf->b_ml.ml_line_count;
} else if (curs < 1) {
curs = 1;
}
for (i = start; i <= end; i++) {
if (minus && i == lnum) {
@@ -2898,8 +2901,11 @@ void ex_z(exarg_T *eap)
}
}
curwin->w_cursor.lnum = curs;
ex_no_reprint = TRUE;
if (curwin->w_cursor.lnum != curs) {
curwin->w_cursor.lnum = curs;
curwin->w_cursor.col = 0;
}
ex_no_reprint = true;
}
/*