diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2021-04-05 20:01:07 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-05 20:01:07 -0400 |
commit | cc9f7e717b80208fec79150b99c17eba04535496 (patch) | |
tree | 6d5e29f0bd7c8b293b873f41324fb813238acb7a /src/nvim/normal.c | |
parent | 2c4e9c5245285b5a0a76e044b72481dfe6c468ab (diff) | |
parent | ce0153e4f77bf325cd8c7565e55b038a3ad6a11c (diff) | |
download | rneovim-cc9f7e717b80208fec79150b99c17eba04535496.tar.gz rneovim-cc9f7e717b80208fec79150b99c17eba04535496.tar.bz2 rneovim-cc9f7e717b80208fec79150b99c17eba04535496.zip |
Merge pull request #14291 from janlazo/vim-8.2.2709
vim-patch:8.2.{2709,2711,2714,2717}
Diffstat (limited to 'src/nvim/normal.c')
-rw-r--r-- | src/nvim/normal.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/nvim/normal.c b/src/nvim/normal.c index 3b40689f3e..f016ef6813 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -3971,7 +3971,8 @@ static bool nv_screengo(oparg_T *oap, int dir, long dist) while (dist--) { if (dir == BACKWARD) { - if (curwin->w_curswant >= width1) { + if (curwin->w_curswant >= width1 + && !hasFolding(curwin->w_cursor.lnum, NULL, NULL)) { // Move back within the line. This can give a negative value // for w_curswant if width1 < width2 (with cpoptions+=n), // which will get clipped to column 0. @@ -4003,14 +4004,16 @@ static bool nv_screengo(oparg_T *oap, int dir, long dist) n = ((linelen - width1 - 1) / width2 + 1) * width2 + width1; else n = width1; - if (curwin->w_curswant + width2 < (colnr_T)n) - /* move forward within line */ + if (curwin->w_curswant + width2 < (colnr_T)n + && !hasFolding(curwin->w_cursor.lnum, NULL, NULL)) { + // move forward within line curwin->w_curswant += width2; - else { - /* to next line */ - /* Move to the end of a closed fold. */ + } else { + // to next line + + // Move to the end of a closed fold. (void)hasFolding(curwin->w_cursor.lnum, NULL, - &curwin->w_cursor.lnum); + &curwin->w_cursor.lnum); if (curwin->w_cursor.lnum == curbuf->b_ml.ml_line_count) { retval = false; break; |