To: vim_dev@googlegroups.com Subject: Patch 7.4.1940 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.4.1940 Problem: "gd" hangs in some situations. (Eric Biggers) Solution: Remove the SEARCH_START flag when looping. Add a test. Files: src/normal.c, src/testdir/test_goto.vim *** ../vim-7.4.1939/src/normal.c 2016-05-24 10:46:41.655541832 +0200 --- src/normal.c 2016-06-15 21:58:13.712716993 +0200 *************** *** 4250,4256 **** int len, int locally, int thisblock, ! int searchflags) /* flags passed to searchit() */ { char_u *pat; pos_T old_pos; --- 4250,4256 ---- int len, int locally, int thisblock, ! int flags_arg) /* flags passed to searchit() */ { char_u *pat; pos_T old_pos; *************** *** 4261,4266 **** --- 4261,4267 ---- int save_p_scs; int retval = OK; int incll; + int searchflags = flags_arg; if ((pat = alloc(len + 7)) == NULL) return FAIL; *************** *** 4346,4353 **** /* For finding a local variable and the match is before the "{" search * to find a later match. For K&R style function declarations this ! * skips the function header without types. */ found_pos = curwin->w_cursor; } if (t == FAIL) --- 4347,4356 ---- /* For finding a local variable and the match is before the "{" search * to find a later match. For K&R style function declarations this ! * skips the function header without types. Remove SEARCH_START from ! * flags to avoid getting stuck at one position. */ found_pos = curwin->w_cursor; + searchflags &= ~SEARCH_START; } if (t == FAIL) *** ../vim-7.4.1939/src/testdir/test_goto.vim 2016-04-16 09:13:31.538407268 +0200 --- src/testdir/test_goto.vim 2016-06-15 21:58:47.884349679 +0200 *************** *** 1,6 **** " Test commands that jump somewhere. ! func Test_geedee() new call setline(1, ["Filename x;", "", "int Filename", "int func() {", "Filename y;"]) /y;/ --- 1,6 ---- " Test commands that jump somewhere. ! func Test_geeDEE() new call setline(1, ["Filename x;", "", "int Filename", "int func() {", "Filename y;"]) /y;/ *************** *** 8,10 **** --- 8,20 ---- call assert_equal(1, line('.')) quit! endfunc + + func Test_gee_dee() + new + call setline(1, ["int x;", "", "int func(int x)", "{", " return x;", "}"]) + /return/ + normal $hgd + call assert_equal(3, line('.')) + call assert_equal(14, col('.')) + quit! + endfunc *** ../vim-7.4.1939/src/version.c 2016-06-15 21:44:47.645388277 +0200 --- src/version.c 2016-06-15 22:02:57.569666438 +0200 *************** *** 755,756 **** --- 755,758 ---- { /* Add new patch number below this line */ + /**/ + 1940, /**/ -- From "know your smileys": <|-) Chinese <|-( Chinese and doesn't like these kind of jokes /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///