diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2018-06-20 00:54:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-20 00:54:25 +0200 |
commit | f389fea8fab5f09fd2a5d82ecbc47c60a5850c5f (patch) | |
tree | ef33f0b1d57780314c194c15a418105fb403635f /src/nvim/normal.c | |
parent | 3cc7462a0cc035c6e97896c12819549ce5e31b10 (diff) | |
parent | 141df73930159682a48f68a89e02f0b5c38ac9e4 (diff) | |
download | rneovim-f389fea8fab5f09fd2a5d82ecbc47c60a5850c5f.tar.gz rneovim-f389fea8fab5f09fd2a5d82ecbc47c60a5850c5f.tar.bz2 rneovim-f389fea8fab5f09fd2a5d82ecbc47c60a5850c5f.zip |
Merge #8503 from janlazo/vim-8.0.0549
Diffstat (limited to 'src/nvim/normal.c')
-rw-r--r-- | src/nvim/normal.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/nvim/normal.c b/src/nvim/normal.c index b959ea08f3..a649777ddd 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -3769,14 +3769,17 @@ find_decl ( t = false; /* match after start is failure too */ if (thisblock && t != false) { - pos_T *pos; - - /* Check that the block the match is in doesn't end before the - * position where we started the search from. */ - if ((pos = findmatchlimit(NULL, '}', FM_FORWARD, - (int)(old_pos.lnum - curwin->w_cursor.lnum + 1))) != NULL - && pos->lnum < old_pos.lnum) + const int64_t maxtravel = old_pos.lnum - curwin->w_cursor.lnum + 1; + const pos_T *pos = findmatchlimit(NULL, '}', FM_FORWARD, maxtravel); + + // Check that the block the match is in doesn't end before the + // position where we started the search from. + if (pos != 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 == false) { @@ -6895,7 +6898,7 @@ static void nv_g_cmd(cmdarg_T *cap) else show_utf8(); break; - + // "g<": show scrollback text case '<': show_sb_text(); break; |