To: vim_dev@googlegroups.com Subject: Patch 8.1.2312 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.2312 Problem: "line:" field in tags file not used. Solution: Recognize the field and use the value. (Andy Massimino, Daniel Hahler, closes #5232, closes #2546, closes #1057) Files: src/tag.c, src/testdir/test_tagjump.vim *** ../vim-8.1.2311/src/tag.c 2019-11-08 21:56:54.779417459 +0100 --- src/tag.c 2019-11-17 16:18:06.817748509 +0100 *************** *** 35,40 **** --- 35,41 ---- char_u *tagkind_end; // end of tagkind char_u *user_data; // user_data string char_u *user_data_end; // end of user_data + linenr_T tagline; // "line:" value } tagptrs_T; /* *************** *** 3217,3222 **** --- 3218,3224 ---- tagp->tagkind = NULL; tagp->user_data = NULL; + tagp->tagline = 0; tagp->command_end = NULL; if (retval == OK) *************** *** 3237,3242 **** --- 3239,3246 ---- tagp->tagkind = p + 5; else if (STRNCMP(p, "user_data:", 10) == 0) tagp->user_data = p + 10; + else if (STRNCMP(p, "line:", 5) == 0) + tagp->tagline = atoi((char *)p + 5); if (tagp->tagkind != NULL && tagp->user_data != NULL) break; pc = vim_strchr(p, ':'); *************** *** 3537,3543 **** p_ic = FALSE; /* don't ignore case now */ p_scs = FALSE; save_lnum = curwin->w_cursor.lnum; ! curwin->w_cursor.lnum = 0; /* start search before first line */ if (do_search(NULL, pbuf[0], pbuf + 1, (long)1, search_options, NULL)) retval = OK; --- 3541,3552 ---- p_ic = FALSE; /* don't ignore case now */ p_scs = FALSE; save_lnum = curwin->w_cursor.lnum; ! if (tagp.tagline > 0) ! // start search before line from "line:" field ! curwin->w_cursor.lnum = tagp.tagline - 1; ! else ! // start search before first line ! curwin->w_cursor.lnum = 0; if (do_search(NULL, pbuf[0], pbuf + 1, (long)1, search_options, NULL)) retval = OK; *** ../vim-8.1.2311/src/testdir/test_tagjump.vim 2019-11-07 23:08:39.245164729 +0100 --- src/testdir/test_tagjump.vim 2019-11-17 16:16:36.833994958 +0100 *************** *** 526,529 **** --- 526,553 ---- call delete('XTest_tselect') endfunc + func Test_tagline() + call writefile([ + \ 'provision Xtest.py /^ def provision(self, **kwargs):$/;" m line:1 language:Python class:Foo', + \ 'provision Xtest.py /^ def provision(self, **kwargs):$/;" m line:3 language:Python class:Bar', + \], 'Xtags') + call writefile([ + \ ' def provision(self, **kwargs):', + \ ' pass', + \ ' def provision(self, **kwargs):', + \ ' pass', + \], 'Xtest.py') + + set tags=Xtags + + 1tag provision + call assert_equal(line('.'), 1) + 2tag provision + call assert_equal(line('.'), 3) + + call delete('Xtags') + call delete('Xtest.py') + set tags& + endfunc + " vim: shiftwidth=2 sts=2 expandtab *** ../vim-8.1.2311/src/version.c 2019-11-16 22:49:34.190410455 +0100 --- src/version.c 2019-11-17 15:59:16.606236491 +0100 *************** *** 743,744 **** --- 743,746 ---- { /* Add new patch number below this line */ + /**/ + 2312, /**/ -- % cat /usr/include/real_life.h void life(void); /// 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 ///