diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2021-01-22 12:23:58 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-22 12:23:58 -0500 |
commit | 24b60322a25b7bc254663d9fc9fbb15cc348b850 (patch) | |
tree | 1b81b4bb63c16cb38eaead41be75885c2200f0da /src/nvim/normal.c | |
parent | 93402606fa46a80dff2362920c85f4497ed2a216 (diff) | |
parent | 30ef922f3908edae9511c029da294b92f342a1cc (diff) | |
download | rneovim-24b60322a25b7bc254663d9fc9fbb15cc348b850.tar.gz rneovim-24b60322a25b7bc254663d9fc9fbb15cc348b850.tar.bz2 rneovim-24b60322a25b7bc254663d9fc9fbb15cc348b850.zip |
Merge pull request #13818 from janlazo/vim-8.2.2379
vim-patch:8.2.{2375,2379,2384,2385}
Diffstat (limited to 'src/nvim/normal.c')
-rw-r--r-- | src/nvim/normal.c | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/src/nvim/normal.c b/src/nvim/normal.c index 4e955667dc..8f22243348 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -3978,16 +3978,19 @@ static bool nv_screengo(oparg_T *oap, int dir, long dist) curwin->w_curswant -= width2; } else { // to previous line + + // Move to the start of a closed fold. Don't do that when + // 'foldopen' contains "all": it will open in a moment. + if (!(fdo_flags & FDO_ALL)) { + (void)hasFolding(curwin->w_cursor.lnum, + &curwin->w_cursor.lnum, NULL); + } if (curwin->w_cursor.lnum == 1) { retval = false; break; } - --curwin->w_cursor.lnum; - /* Move to the start of a closed fold. Don't do that when - * 'foldopen' contains "all": it will open in a moment. */ - if (!(fdo_flags & FDO_ALL)) - (void)hasFolding(curwin->w_cursor.lnum, - &curwin->w_cursor.lnum, NULL); + curwin->w_cursor.lnum--; + linelen = linetabsize(get_cursor_line_ptr()); if (linelen > width1) { int w = (((linelen - width1 - 1) / width2) + 1) * width2; @@ -6708,11 +6711,8 @@ static void nv_g_cmd(cmdarg_T *cap) */ case 'j': case K_DOWN: - /* with 'nowrap' it works just like the normal "j" command; also when - * in a closed fold */ - if (!curwin->w_p_wrap - || hasFolding(curwin->w_cursor.lnum, NULL, NULL) - ) { + // with 'nowrap' it works just like the normal "j" command. + if (!curwin->w_p_wrap) { oap->motion_type = kMTLineWise; i = cursor_down(cap->count1, oap->op_type == OP_NOP); } else @@ -6723,11 +6723,8 @@ static void nv_g_cmd(cmdarg_T *cap) case 'k': case K_UP: - /* with 'nowrap' it works just like the normal "k" command; also when - * in a closed fold */ - if (!curwin->w_p_wrap - || hasFolding(curwin->w_cursor.lnum, NULL, NULL) - ) { + // with 'nowrap' it works just like the normal "k" command. + if (!curwin->w_p_wrap) { oap->motion_type = kMTLineWise; i = cursor_up(cap->count1, oap->op_type == OP_NOP); } else |