aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/normal.c
diff options
context:
space:
mode:
authorluukvbaal <31730729+luukvbaal@users.noreply.github.com>2023-02-19 01:33:02 +0100
committerGitHub <noreply@github.com>2023-02-19 08:33:02 +0800
commitcbd4480f97a913e0e356ec02f652b693b0195767 (patch)
treebd3225f1f046bc8702393d371b8fddb3bc82bbac /src/nvim/normal.c
parent2f6413797499a1bdac28c20a491e8ea3be33bda3 (diff)
downloadrneovim-cbd4480f97a913e0e356ec02f652b693b0195767.tar.gz
rneovim-cbd4480f97a913e0e356ec02f652b693b0195767.tar.bz2
rneovim-cbd4480f97a913e0e356ec02f652b693b0195767.zip
vim-patch:9.0.1324: "gj" and "gk" do not move correctly over a closed fold (#22320)
Problem: "gj" and "gk" do not move correctly over a closed fold. Solution: Use the same code as used for "j"/"k" to go to the next/previous line. (Luuk van Baal, closes vim/vim#12007) https://github.com/vim/vim/commit/441a7a94482f704b66253b8d08130f27b6b13736
Diffstat (limited to 'src/nvim/normal.c')
-rw-r--r--src/nvim/normal.c18
1 files changed, 2 insertions, 16 deletions
diff --git a/src/nvim/normal.c b/src/nvim/normal.c
index f1226584d7..5677c627a7 100644
--- a/src/nvim/normal.c
+++ b/src/nvim/normal.c
@@ -2479,19 +2479,10 @@ 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) {
+ if (!cursor_up_inner(curwin, 1)) {
retval = false;
break;
}
- curwin->w_cursor.lnum--;
-
linelen = linetabsize(get_cursor_line_ptr());
if (linelen > width1) {
int w = (((linelen - width1 - 1) / width2) + 1) * width2;
@@ -2511,15 +2502,10 @@ static bool nv_screengo(oparg_T *oap, int dir, long dist)
curwin->w_curswant += width2;
} else {
// to next line
-
- // Move to the end of a closed fold.
- (void)hasFolding(curwin->w_cursor.lnum, NULL,
- &curwin->w_cursor.lnum);
- if (curwin->w_cursor.lnum == curbuf->b_ml.ml_line_count) {
+ if (!cursor_down_inner(curwin, 1)) {
retval = false;
break;
}
- curwin->w_cursor.lnum++;
curwin->w_curswant %= width2;
// Check if the cursor has moved below the number display
// when width1 < width2 (with cpoptions+=n). Subtract width2