diff options
-rw-r--r-- | src/normal.c | 6 | ||||
-rw-r--r-- | src/testdir/test_goto.vim | 21 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 29 insertions, 0 deletions
diff --git a/src/normal.c b/src/normal.c index 53bda6cc7..25c0986b4 100644 --- a/src/normal.c +++ b/src/normal.c @@ -4371,7 +4371,12 @@ find_decl( if ((pos = findmatchlimit(NULL, '}', FM_FORWARD, (int)(old_pos.lnum - curwin->w_cursor.lnum + 1))) != NULL && pos->lnum < old_pos.lnum) + { + /* There can't be a useful match before the end of this block. + * Skip to the end. */ + curwin->w_cursor = *pos; continue; + } } if (t == FAIL) @@ -8311,6 +8316,7 @@ nv_g_cmd(cmdarg_T *cap) break; #endif + /* "g<": show scrollback text */ case '<': show_sb_text(); break; diff --git a/src/testdir/test_goto.vim b/src/testdir/test_goto.vim index 257340170..ea67fe738 100644 --- a/src/testdir/test_goto.vim +++ b/src/testdir/test_goto.vim @@ -288,3 +288,24 @@ func Test_cursorline_keep_col() set nocursorline endfunc +func Test_gd_local_block() + let lines = [ + \ ' int main()', + \ '{', + \ ' char *a = "NOT NULL";', + \ ' if(a)', + \ ' {', + \ ' char *b = a;', + \ ' printf("%s\n", b);', + \ ' }', + \ ' else', + \ ' {', + \ ' char *b = "NULL";', + \ ' return b;', + \ ' }', + \ '', + \ ' return 0;', + \ '}', + \ ] + call XTest_goto_decl('1gd', lines, 11, 11) +endfunc diff --git a/src/version.c b/src/version.c index 487712d06..b9790d41e 100644 --- a/src/version.c +++ b/src/version.c @@ -765,6 +765,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 568, +/**/ 567, /**/ 566, |