To: vim-dev@vim.org Subject: Patch 7.2b.029 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 7.2b.029 Problem: ":help a" doesn't jump to *a* tag in docs. (Tony Mechelynck) Solution: Get all tags and throw away more than TAG_MANY after sorting. When there is no argument find matches for "help" to avoid a long delay. Files: src/ex_cmds.c, src/ex_getln.c *** ../vim-7.2b.028/src/ex_cmds.c Thu Jul 24 21:30:10 2008 --- src/ex_cmds.c Mon Aug 4 21:15:00 2008 *************** *** 5897,5908 **** flags = TAG_HELP | TAG_REGEXP | TAG_NAMES | TAG_VERBOSE; if (keep_lang) flags |= TAG_KEEP_LANG; ! if (find_tags(IObuff, num_matches, matches, flags, TAG_MANY, NULL) == OK && *num_matches > 0) /* Sort the matches found on the heuristic number that is after the * tag name. */ qsort((void *)*matches, (size_t)*num_matches, sizeof(char_u *), help_compare); return OK; } --- 5897,5913 ---- flags = TAG_HELP | TAG_REGEXP | TAG_NAMES | TAG_VERBOSE; if (keep_lang) flags |= TAG_KEEP_LANG; ! if (find_tags(IObuff, num_matches, matches, flags, (int)MAXCOL, NULL) == OK && *num_matches > 0) + { /* Sort the matches found on the heuristic number that is after the * tag name. */ qsort((void *)*matches, (size_t)*num_matches, sizeof(char_u *), help_compare); + /* Delete more than TAG_MANY to reduce the size of the listing. */ + while (*num_matches > TAG_MANY) + vim_free((*matches)[--*num_matches]); + } return OK; } *** ../vim-7.2b.028/src/ex_getln.c Wed Aug 6 14:18:37 2008 --- src/ex_getln.c Wed Aug 6 12:49:07 2008 *************** *** 4387,4393 **** *num_file = 0; if (xp->xp_context == EXPAND_HELP) { ! if (find_help_tags(pat, num_file, file, FALSE) == OK) { #ifdef FEAT_MULTI_LANG cleanup_help_tags(*num_file, *file); --- 4387,4396 ---- *num_file = 0; if (xp->xp_context == EXPAND_HELP) { ! /* With an empty argument we would get all the help tags, which is ! * very slow. Get matches for "help" instead. */ ! if (find_help_tags(*pat == NUL ? (char_u *)"help" : pat, ! num_file, file, FALSE) == OK) { #ifdef FEAT_MULTI_LANG cleanup_help_tags(*num_file, *file); *** ../vim-7.2b.028/src/version.c Wed Aug 6 14:37:06 2008 --- src/version.c Wed Aug 6 15:00:50 2008 *************** *** 678,679 **** --- 678,681 ---- { /* Add new patch number below this line */ + /**/ + 29, /**/ -- Compilation process failed successfully. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ download, build and distribute -- http://www.A-A-P.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///