To: vim-dev@vim.org Subject: Patch 5.6.080 Fcc: outbox From: Bram Moolenaar ------------ Patch 5.6.080 Problem: When jumping to a tag, generating the tags file and jumping to the same tag again uses the old search pattern. (Sung-Hyun Nam) Solution: Flush cached tag matches when executing an external command. Files: src/misc2.c, src/proto/tag.pro, src/tag.c *** ../vim-5.6.79/src/misc2.c Thu Jun 1 19:54:28 2000 --- src/misc2.c Sun Jun 4 19:58:29 2000 *************** *** 1991,1996 **** --- 1991,1998 ---- #ifdef USE_GUI ++hold_gui_events; #endif + /* The external command may update a tags file, clear cached tags. */ + tag_freematch(); if (cmd == NULL || *p_sxq == NUL) retval = mch_call_shell(cmd, opt); *** ../vim-5.6.79/src/proto/tag.pro Sun Jan 16 14:22:58 2000 --- src/proto/tag.pro Sun Jun 4 19:55:39 2000 *************** *** 1,5 **** --- 1,6 ---- /* tag.c */ int do_tag __ARGS((char_u *tag, int type, int count, int forceit, int verbose)); + void tag_freematch __ARGS((void)); void do_tags __ARGS((void)); int find_tags __ARGS((char_u *pat, int *num_matches, char_u ***matchesp, int flags, int mincount)); void simplify_filename __ARGS((char_u *filename)); *** ../vim-5.6.79/src/tag.c Mon Apr 3 09:35:20 2000 --- src/tag.c Sun Jun 4 19:53:58 2000 *************** *** 86,91 **** --- 86,93 ---- static char_u *bottommsg = (char_u *)"at bottom of tag stack"; static char_u *topmsg = (char_u *)"at top of tag stack"; + static char_u *tagmatchname = NULL; /* name of last used tag */ + /* * We use ftello() here, if available. It returns off_t instead of long, * which helps if long is 32 bit and off_t is 64 bit. *************** *** 153,159 **** static int max_num_matches = 0; /* limit used for match search */ static char_u **matches = NULL; static int flags; - static char_u *matchname = NULL; if (type == DT_HELP) { --- 155,160 ---- *************** *** 353,367 **** name = tag; else name = tagstack[tagstackidx].tagname; ! other_name = (matchname == NULL || STRCMP(matchname, name) != 0); if (new_tag || (cur_match >= num_matches && max_num_matches != MAXCOL) || other_name) { if (other_name) { ! vim_free(matchname); ! matchname = vim_strsave(name); } if (type == DT_SELECT || type == DT_JUMP) --- 354,368 ---- name = tag; else name = tagstack[tagstackidx].tagname; ! other_name = (tagmatchname == NULL || STRCMP(tagmatchname, name) != 0); if (new_tag || (cur_match >= num_matches && max_num_matches != MAXCOL) || other_name) { if (other_name) { ! vim_free(tagmatchname); ! tagmatchname = vim_strsave(name); } if (type == DT_SELECT || type == DT_JUMP) *************** *** 745,750 **** --- 746,761 ---- #endif } + /* + * Free cached tags. + */ + void + tag_freematch() + { + vim_free(tagmatchname); + tagmatchname = NULL; + } + static void taglen_advance(l) int l; *** ../vim-5.6.79/src/version.c Sun Jun 4 20:10:53 2000 --- src/version.c Sun Jun 4 20:10:38 2000 *************** *** 420,421 **** --- 420,423 ---- { /* Add new patch number below this line */ + /**/ + 80, /**/ -- SOLDIER: What? Ridden on a horse? ARTHUR: Yes! SOLDIER: You're using coconuts! "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /-/-- Bram Moolenaar --- Bram@moolenaar.net --- http://www.moolenaar.net --\-\ \-\-- Vim: http://www.vim.org ---- ICCF Holland: http://www.vim.org/iccf --/-/