0
0
mirror of https://github.com/vim/vim.git synced 2025-09-07 22:03:36 -04:00

patch 8.0.0568: 1gd may hang

Problem:    "1gd" may hang.
Solution:   Don't get stuck in one position. (Christian Brabandt, closes #1643)
This commit is contained in:
Bram Moolenaar 2017-04-20 18:54:50 +02:00
parent fc8f1118e7
commit 60402d68da
3 changed files with 29 additions and 0 deletions

View File

@ -4371,7 +4371,12 @@ find_decl(
if ((pos = findmatchlimit(NULL, '}', FM_FORWARD, if ((pos = findmatchlimit(NULL, '}', FM_FORWARD,
(int)(old_pos.lnum - curwin->w_cursor.lnum + 1))) != NULL (int)(old_pos.lnum - curwin->w_cursor.lnum + 1))) != NULL
&& pos->lnum < old_pos.lnum) && 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; continue;
}
} }
if (t == FAIL) if (t == FAIL)
@ -8311,6 +8316,7 @@ nv_g_cmd(cmdarg_T *cap)
break; break;
#endif #endif
/* "g<": show scrollback text */
case '<': case '<':
show_sb_text(); show_sb_text();
break; break;

View File

@ -288,3 +288,24 @@ func Test_cursorline_keep_col()
set nocursorline set nocursorline
endfunc 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

View File

@ -764,6 +764,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
568,
/**/ /**/
567, 567,
/**/ /**/