On 2015-11-02, Gary Johnson wrote:
> On 2015-11-01, Gary Johnson wrote:
> > On 2015-10-30, Bram Moolenaar wrote:
> > > Jonathan Newton wrote:
> 
> > > > Do you expect to accept this patch sometime soon? 
> > > 
> > > Not sure.  We already have so many options...
> > > But it does make sense to limit the places where 'ignorecase' applies.
> > > 
> > > It should probably be buffer-local, how tags are used depends on the
> > > type of file.
> > 
> > Probably global-local, as 'tags' is.  I'll try to figure out how to
> > do that.  Probably needs a test, too.
> 
> I encountered a conflict while making this option global-local.  I
> had been using the <empty> value to mean that the case-sensitivity
> used for tag searches should follow the 'ignorecase' option.
> However, when an option is global or local to a buffer, setting the
> local value to <empty> means to follow the global value.
> 
> I think the only way to resolve this is to disallow <empty> as a
> valid global value and use a word such as "follow" to mean "follow
> the value of 'ignorecase'".
> 
> Does that seem OK?  Is there a better word for this?
> 
> I've written a test for the global-only behavior.  I'll update it to
> test the global-local behavior as well.

Here is the latest (final?) patch.  It implements the 'tagcase'
option as a global-local option as described here:

                                                  *'tagcase'* *'tc'*
    'tagcase' 'tc'          string  (default "followic")
                            global or local to buffer |global-local|
                            {not in Vi}
            This option specifies how case is handled when searching
            the tags file:
               followic     Follow the 'ignorecase' option
               ignore       Ignore case
               match        Match case

A test is included.

Regards,
Gary

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.
diff -r 30042ddff503 runtime/doc/options.txt
--- a/runtime/doc/options.txt	Tue Oct 13 23:30:05 2015 +0200
+++ b/runtime/doc/options.txt	Fri Nov 06 16:32:10 2015 -0800
@@ -4109,7 +4109,7 @@
 			global
 	Ignore case in search patterns.  Also used when searching in the tags
 	file.
-	Also see 'smartcase'.
+	Also see 'smartcase' and 'tagcase'.
 	Can be overruled by using "\c" or "\C" in the pattern, see
 	|/ignorecase|.
 
@@ -7284,19 +7284,22 @@
 <	[The whitespace before and after the '0' must be a single <Tab>]
 
 	When a binary search was done and no match was found in any of the
-	files listed in 'tags', and 'ignorecase' is set or a pattern is used
+	files listed in 'tags', and case is ignored or a pattern is used
 	instead of a normal tag name, a retry is done with a linear search.
 	Tags in unsorted tags files, and matches with different case will only
 	be found in the retry.
 
 	If a tag file indicates that it is case-fold sorted, the second,
-	linear search can be avoided for the 'ignorecase' case.  Use a value
-	of '2' in the "!_TAG_FILE_SORTED" line for this.  A tag file can be
-	case-fold sorted with the -f switch to "sort" in most unices, as in
-	the command: "sort -f -o tags tags".  For "Exuberant ctags" version
-	5.x or higher (at least 5.5) the --sort=foldcase switch can be used
-	for this as well.  Note that case must be folded to uppercase for this
-	to work.
+	linear search can be avoided when case is ignored.  Use a value of '2'
+	in the "!_TAG_FILE_SORTED" line for this.  A tag file can be case-fold
+	sorted with the -f switch to "sort" in most unices, as in the command:
+	"sort -f -o tags tags".  For "Exuberant ctags" version 5.x or higher
+	(at least 5.5) the --sort=foldcase switch can be used for this as
+	well.  Note that case must be folded to uppercase for this to work.
+
+	By default, tag searches are case-sensitive.  Case is ignored when
+	'ignorecase' is set and 'tagcase' is "followic", or when 'tagcase' is
+	"ignore".
 
 	When 'tagbsearch' is off, tags searching is slower when a full match
 	exists, but faster when no full match exists.  Tags in unsorted tags
@@ -7308,6 +7311,16 @@
 	command-line completion and ":help").
 	{Vi: always uses binary search in some versions}
 
+							*'tagcase'* *'tc'*
+'tagcase' 'tc'		string	(default "followic")
+			global or local to buffer |global-local|
+			{not in Vi}
+	This option specifies how case is handled when searching the tags
+	file:
+	   followic	Follow the 'ignorecase' option
+	   ignore	Ignore case
+	   match	Match case
+
 						*'taglength'* *'tl'*
 'taglength' 'tl'	number	(default 0)
 			global
diff -r 30042ddff503 runtime/doc/quickref.txt
--- a/runtime/doc/quickref.txt	Tue Oct 13 23:30:05 2015 +0200
+++ b/runtime/doc/quickref.txt	Fri Nov 06 16:32:10 2015 -0800
@@ -899,6 +899,7 @@
 'tabpagemax'	  'tpm'     maximum number of tab pages for |-p| and "tab all"
 'tabstop'	  'ts'	    number of spaces that <Tab> in file uses
 'tagbsearch'	  'tbs'     use binary searching in tags files
+'tagcase'	  'tc'      how to handle case when searching in tags files
 'taglength'	  'tl'	    number of significant characters for a tag
 'tagrelative'	  'tr'	    file names in tag file are relative
 'tags'		  'tag'     list of file names used by the tag command
diff -r 30042ddff503 runtime/doc/tags
--- a/runtime/doc/tags	Tue Oct 13 23:30:05 2015 +0200
+++ b/runtime/doc/tags	Fri Nov 06 16:32:10 2015 -0800
@@ -1011,6 +1011,7 @@
 'tabstop'	options.txt	/*'tabstop'*
 'tag'	options.txt	/*'tag'*
 'tagbsearch'	options.txt	/*'tagbsearch'*
+'tagcase'	options.txt	/*'tagcase'*
 'taglength'	options.txt	/*'taglength'*
 'tagrelative'	options.txt	/*'tagrelative'*
 'tags'	options.txt	/*'tags'*
@@ -1021,6 +1022,7 @@
 'tbidi'	options.txt	/*'tbidi'*
 'tbis'	options.txt	/*'tbis'*
 'tbs'	options.txt	/*'tbs'*
+'tc'	options.txt	/*'tc'*
 'tenc'	options.txt	/*'tenc'*
 'term'	options.txt	/*'term'*
 'termbidi'	options.txt	/*'termbidi'*
diff -r 30042ddff503 runtime/doc/tagsrch.txt
--- a/runtime/doc/tagsrch.txt	Tue Oct 13 23:30:05 2015 +0200
+++ b/runtime/doc/tagsrch.txt	Fri Nov 06 16:32:10 2015 -0800
@@ -85,11 +85,13 @@
 ":tag {ident}".
 
 The ignore-case matches are not found for a ":tag" command when the
-'ignorecase' option is off.  They are found when a pattern is used (starting
-with a "/") and for ":tselect", also when 'ignorecase' is off.  Note that
-using ignore-case tag searching disables binary searching in the tags file,
-which causes a slowdown.  This can be avoided by fold-case sorting the tag
-file.  See the 'tagbsearch' option for an explanation.
+'ignorecase' option is off and 'tagcase' is "followic" or when 'tagcase' is
+"match".  They are found when a pattern is used (starting with a "/") and for
+":tselect", also when 'ignorecase' is off and 'tagcase' is "followic" or when
+'tagcase' is "match".  Note that using ignore-case tag searching disables
+binary searching in the tags file, which causes a slowdown.  This can be
+avoided by fold-case sorting the tag file.  See the 'tagbsearch' option for an
+explanation.
 
 ==============================================================================
 2. Tag stack				*tag-stack* *tagstack* *E425*
@@ -440,12 +442,13 @@
 The next file in the list is not used when:
 - A matching static tag for the current buffer has been found.
 - A matching global tag has been found.
-This also depends on the 'ignorecase' option.  If it is off, and the tags file
-only has a match without matching case, the next tags file is searched for a
-match with matching case.  If no tag with matching case is found, the first
-match without matching case is used.  If 'ignorecase' is on, and a matching
-global tag with or without matching case is found, this one is used, no
-further tags files are searched.
+This also depends on whether case is ignored.  Case is ignored when
+'ignorecase' is set and 'tagcase' is "followic", or when 'tagcase' is
+"ignore".  If case is not ignored, and the tags file only has a match without
+matching case, the next tags file is searched for a match with matching case.
+If no tag with matching case is found, the first match without matching case
+is used.  If case is ignored, and a matching global tag with or without
+matching case is found, this one is used, no further tags files are searched.
 
 When a tag file name starts with "./", the '.' is replaced with the path of
 the current file.  This makes it possible to use a tags file in the directory
@@ -579,8 +582,10 @@
 binary searching for the tags file:
 	!_TAG_FILE_SORTED<Tab>1<Tab>{anything} ~
 
-A tag file may be case-fold sorted to avoid a linear search when 'ignorecase'
-is on.  See 'tagbsearch' for details.  The value '2' should be used then:
+A tag file may be case-fold sorted to avoid a linear search when case is
+ignored.  (Case is ignored when 'ignorecase' is set and 'tagcase' is
+"followic", or when 'tagcase' is "ignore".)  See 'tagbsearch' for details.
+The value '2' should be used then:
 	!_TAG_FILE_SORTED<Tab>2<Tab>{anything} ~
 
 The other tag that Vim recognizes, but only when compiled with the
diff -r 30042ddff503 runtime/doc/usr_29.txt
--- a/runtime/doc/usr_29.txt	Tue Oct 13 23:30:05 2015 +0200
+++ b/runtime/doc/usr_29.txt	Fri Nov 06 16:32:10 2015 -0800
@@ -255,7 +255,8 @@
 
 RELATED ITEMS
 
-You can set 'ignorecase' to make case in tag names be ignored.
+To make case in tag names be ignored, you can set 'ignorecase' while leaving
+'tagcase' as "followic", or set 'tagcase' to "ignore".
 
 The 'tagbsearch' option tells if the tags file is sorted or not.  The default
 is to assume a sorted tags file, which makes a tags search a lot faster, but
diff -r 30042ddff503 runtime/optwin.vim
--- a/runtime/optwin.vim	Tue Oct 13 23:30:05 2015 +0200
+++ b/runtime/optwin.vim	Fri Nov 06 16:32:10 2015 -0800
@@ -289,6 +289,10 @@
 call append("$", "tags\tlist of file names to search for tags")
 call append("$", "\t(global or local to buffer)")
 call <SID>OptionG("tag", &tag)
+call append("$", "tagcase\thow to handle case when searching in tags files:")
+call append("$", "\t\"followic\" to follow 'ignorecase', \"ignore\" or \"match\"")
+call append("$", "\t(global or local to buffer)")
+call <SID>OptionG("tc", &tc)
 call append("$", "tagrelative\tfile names in a tags file are relative to the tags file")
 call <SID>BinOptionG("tr", &tr)
 call append("$", "tagstack\ta :tag command will use the tagstack")
diff -r 30042ddff503 runtime/syntax/vim.vim
--- a/runtime/syntax/vim.vim	Tue Oct 13 23:30:05 2015 +0200
+++ b/runtime/syntax/vim.vim	Fri Nov 06 16:32:10 2015 -0800
@@ -31,7 +31,7 @@
 syn keyword vimOption contained	acd ambw ari aw backupext beval biosk breakindent bsdir cb cfu cinkeys cmdheight colorcolumn completefunc copyindent cryptmethod cscopeverbose csverb debug dict dir eb enc errorbells expandtab fdl fenc fileencodings fkmap foldenable foldminlines formatprg gdefault gp guifontset helpfile hidden hl ignorecase imcmdline imsf indentexpr is isp keywordprg laststatus lisp loadplugins macatsui maxcombine mef mls modelines mousehide mp nu omnifunc paragraphs penc pm printdevice printoptions quoteescape remap rightleftcmd rtp sbo scrolljump sel shell shelltype shortname shq sm so spellfile spr st sts swapsync syn tag tb termbidi tgst titleold top ttimeoutlen ttyscroll ul ur verbosefile visualbell wcm wi wildmenu winfixwidth wm wrapscan
 syn keyword vimOption contained	ai anti arshape awa backupskip bex bioskey breakindentopt bsk cc ch cino cmdwinheight columns completeopt cot cscopepathcomp cspc cuc deco dictionary directory ed encoding errorfile exrc fdls fencs fileformat flp foldexpr foldnestmax fp gfm grepformat guifontwide helpheight highlight hlg im imd imstatusfunc indentkeys isf isprint km lazyredraw lispwords lpl magic maxfuncdepth menuitems mm modifiable mousem mps number opendevice paste pex pmbcs printencoding prompt rdt renderoptions rl ru sbr scrolloff selection shellcmdflag shellxescape showbreak si smartcase softtabstop spelllang sps sta su swb synmaxcol tagbsearch tbi termencoding thesaurus titlestring tpm ttm ttytype undodir ut vfile vop wd wic wildmode winheight wmh write
 syn keyword vimOption contained	akm antialias autochdir background balloondelay bexpr bk bri bt ccv charconvert cinoptions cmp com concealcursor cp cscopeprg csprg cul def diff display edcompatible endofline errorformat fcl fdm fex fileformats fml foldignore foldopen fs gfn grepprg guiheadroom helplang history hls imactivatefunc imdisable inc indk isfname joinspaces kmp lbr list ls makeef maxmapdepth mfd mmd modified mousemodel msm numberwidth operatorfunc pastetoggle pexpr pmbfn printexpr pt re report rlc ruf sc scrollopt selectmode shellpipe shellxquote showcmd sidescroll smartindent sol spellsuggest sr stal sua swf syntax taglength tbidi terse tildeop tl tr tty tw undofile vb vi wa weirdinvert wig wildoptions winminheight wmnu writeany
-syn keyword vimOption contained	al ar autoindent backspace ballooneval bg bkc briopt bufhidden cd ci cinw cms comments conceallevel cpo cscopequickfix csqf cursorbind define diffexpr dy ef eol esckeys fcs fdn ff fileignorecase fmr foldlevel foldtext fsync gfs gtl guioptions hf hk hlsearch imactivatekey imi include inex isi js kp lcs listchars lsp makeprg maxmem mh mmp more mouses mzq nuw opfunc patchexpr pfn popt printfont pumheight readonly restorescreen rnu ruler scb scs sessionoptions shellquote shiftround showfulltag sidescrolloff smarttab sp spf srr startofline suffixes switchbuf ta tagrelative tbis textauto timeout tm ts ttybuiltin tx undolevels vbs viewdir wak wfh wildchar wim winminwidth wmw writebackup
+syn keyword vimOption contained	al ar autoindent backspace ballooneval bg bkc briopt bufhidden cd ci cinw cms comments conceallevel cpo cscopequickfix csqf cursorbind define diffexpr dy ef eol esckeys fcs fdn ff fileignorecase fmr foldlevel foldtext fsync gfs gtl guioptions hf hk hlsearch imactivatekey imi include inex isi js kp lcs listchars lsp makeprg maxmem mh mmp more mouses mzq nuw opfunc patchexpr pfn popt printfont pumheight readonly restorescreen rnu ruler scb scs sessionoptions shellquote shiftround showfulltag sidescrolloff smarttab sp spf srr startofline suffixes switchbuf ta tagcase tagrelative tbis tc textauto timeout tm ts ttybuiltin tx undolevels vbs viewdir wak wfh wildchar wim winminwidth wmw writebackup
 syn keyword vimOption contained	aleph arab autoread backup balloonexpr bh bl brk buflisted cdpath cin cinwords co commentstring confirm cpoptions cscoperelative csre cursorcolumn delcombine diffopt ea efm ep et fdc fdo ffs filetype fo foldlevelstart formatexpr ft gfw gtt guipty hh hkmap ic imaf iminsert includeexpr inf isident key langmap linebreak lm lw mat maxmempattern mis mmt mouse mouseshape mzquantum odev osfiletype patchmode ph preserveindent printheader pvh redrawtime revins ro rulerformat scr sect sft shellredir shiftwidth showmatch siso smc spc spl ss statusline suffixesadd sws tabline tags tbs textmode timeoutlen to tsl ttyfast uc undoreload vdir viewoptions warn wfw wildcharm winaltkeys winwidth wop writedelay
 syn keyword vimOption contained	allowrevins arabic autowrite backupcopy bdir bin bomb browsedir buftype cedit cindent clipboard cocu compatible consk cpt cscopetag cst cursorline dex digraph ead ei equalalways eventignore fde fdt fic fillchars foldclose foldmarker formatlistpat gcr ghr guicursor guitablabel hi hkmapp icon imak ims incsearch infercase isk keymap langmenu lines lmap lz matchpairs maxmemtot mkspellmem mod mousef mouset nf oft pa path pheader previewheight printmbcharset pvw regexpengine ri rop runtimepath scroll sections sh shellslash shm showmode sj smd spell splitbelow ssl stl sw sxe tabpagemax tagstack tenc textwidth title toolbar tsr ttym udf updatecount ve viminfo wb wh wildignore window wiv wrap ws
 syn keyword vimOption contained	altkeymap arabicshape autowriteall backupdir bdlay binary breakat bs casemap cf cink cm cole complete conskey crb cscopetagorder csto cwh dg dip eadirection ek equalprg ex fdi fen fileencoding fk foldcolumn foldmethod formatoptions gd go guifont guitabtooltip hid hkp iconstring imc imsearch inde insertmode iskeyword keymodel langnoremap linespace lnr ma matchtime mco ml modeline mousefocus mousetime nrformats ofu para pdev pi previewwindow printmbfont qe relativenumber rightleft rs sb scrollbind secure shcf shelltemp shortmess showtabline slm sn spellcapcheck splitright ssop stmp swapfile sxq tabstop tal term tf titlelen toolbariconsize ttimeout ttymouse udir updatetime verbose virtualedit wc whichwrap wildignorecase winfixheight wiw wrapmargin ww
diff -r 30042ddff503 src/Makefile
--- a/src/Makefile	Tue Oct 13 23:30:05 2015 +0200
+++ b/src/Makefile	Fri Nov 06 16:32:10 2015 -0800
@@ -1928,6 +1928,7 @@
 	test_search_mbyte \
 	test_set \
 	test_signs \
+	test_tagcase \
 	test_textobjects \
 	test_utf8 \
 	test_writefile \
diff -r 30042ddff503 src/buffer.c
--- a/src/buffer.c	Tue Oct 13 23:30:05 2015 +0200
+++ b/src/buffer.c	Fri Nov 06 16:32:10 2015 -0800
@@ -1991,6 +1991,7 @@
     clear_string_option(&buf->b_p_ep);
     clear_string_option(&buf->b_p_path);
     clear_string_option(&buf->b_p_tags);
+    clear_string_option(&buf->b_p_tc);
 #ifdef FEAT_INS_EXPAND
     clear_string_option(&buf->b_p_dict);
     clear_string_option(&buf->b_p_tsr);
diff -r 30042ddff503 src/option.c
--- a/src/option.c	Tue Oct 13 23:30:05 2015 +0200
+++ b/src/option.c	Fri Nov 06 16:32:10 2015 -0800
@@ -174,6 +174,7 @@
 #define PV_SW		OPT_BUF(BV_SW)
 #define PV_SWF		OPT_BUF(BV_SWF)
 #define PV_TAGS		OPT_BOTH(OPT_BUF(BV_TAGS))
+#define PV_TC		OPT_BOTH(OPT_BUF(BV_TC))
 #define PV_TS		OPT_BUF(BV_TS)
 #define PV_TW		OPT_BUF(BV_TW)
 #define PV_TX		OPT_BUF(BV_TX)
@@ -2577,6 +2578,9 @@
 			    {(char_u *)TRUE, (char_u *)0L}
 #endif
 			    SCRIPTID_INIT},
+    {"tagcase",	    "tc",   P_STRING|P_VIM,
+			    (char_u *)&p_tc, PV_TC,
+			    {(char_u *)"followic", (char_u *)"followic"} SCRIPTID_INIT},
     {"taglength",   "tl",   P_NUM|P_VI_DEF,
 			    (char_u *)&p_tl, PV_NONE,
 			    {(char_u *)0L, (char_u *)0L} SCRIPTID_INIT},
@@ -5335,6 +5339,7 @@
     (void)opt_strings_flags(p_fdo, p_fdo_values, &fdo_flags, TRUE);
 #endif
     (void)opt_strings_flags(p_dy, p_dy_values, &dy_flags, TRUE);
+    (void)opt_strings_flags(p_tc, p_tc_values, &tc_flags, FALSE);
 #ifdef FEAT_VIRTUALEDIT
     (void)opt_strings_flags(p_ve, p_ve_values, &ve_flags, TRUE);
 #endif
@@ -5497,6 +5502,7 @@
     check_string_option(&buf->b_p_ep);
     check_string_option(&buf->b_p_path);
     check_string_option(&buf->b_p_tags);
+    check_string_option(&buf->b_p_tc);
 #ifdef FEAT_INS_EXPAND
     check_string_option(&buf->b_p_dict);
     check_string_option(&buf->b_p_tsr);
@@ -7016,6 +7022,30 @@
 	    errmsg = e_invarg;
     }
 
+    /* 'tagcase' */
+    else if (gvarp == &p_tc)
+    {
+	unsigned int	*flags;
+
+	if (opt_flags & OPT_LOCAL)
+	{
+	    p = curbuf->b_p_tc;
+	    flags = &curbuf->b_tc_flags;
+	}
+	else
+	{
+	    p = p_tc;
+	    flags = &tc_flags;
+	}
+
+	if ((opt_flags & OPT_LOCAL) && *p == NUL)
+	    /* make the local value empty: use the global value */
+	    *flags = 0;
+	else if (*p == NUL
+		|| opt_strings_flags(p, p_tc_values, flags, FALSE) != OK)
+	    errmsg = e_invarg;
+    }
+
 #ifdef FEAT_MBYTE
     /* 'casemap' */
     else if (varp == &p_cmp)
@@ -10055,6 +10085,10 @@
 	case PV_TAGS:
 	    clear_string_option(&buf->b_p_tags);
 	    break;
+	case PV_TC:
+	    clear_string_option(&buf->b_p_tc);
+	    buf->b_tc_flags = 0;
+	    break;
 #ifdef FEAT_FIND_ID
 	case PV_DEF:
 	    clear_string_option(&buf->b_p_def);
@@ -10136,6 +10170,7 @@
 	    case PV_PATH: return (char_u *)&(curbuf->b_p_path);
 	    case PV_AR:   return (char_u *)&(curbuf->b_p_ar);
 	    case PV_TAGS: return (char_u *)&(curbuf->b_p_tags);
+	    case PV_TC:   return (char_u *)&(curbuf->b_p_tc);
 #ifdef FEAT_FIND_ID
 	    case PV_DEF:  return (char_u *)&(curbuf->b_p_def);
 	    case PV_INC:  return (char_u *)&(curbuf->b_p_inc);
@@ -10190,6 +10225,8 @@
 				    ? (char_u *)&(curbuf->b_p_ar) : p->var;
 	case PV_TAGS:	return *curbuf->b_p_tags != NUL
 				    ? (char_u *)&(curbuf->b_p_tags) : p->var;
+	case PV_TC:	return *curbuf->b_p_tc != NUL
+				    ? (char_u *)&(curbuf->b_p_tc) : p->var;
 	case PV_BKC:	return *curbuf->b_p_bkc != NUL
 				    ? (char_u *)&(curbuf->b_p_bkc) : p->var;
 #ifdef FEAT_FIND_ID
@@ -10798,6 +10835,8 @@
 	    buf->b_p_kp = empty_option;
 	    buf->b_p_path = empty_option;
 	    buf->b_p_tags = empty_option;
+	    buf->b_p_tc = empty_option;
+	    buf->b_tc_flags = 0;
 #ifdef FEAT_FIND_ID
 	    buf->b_p_def = empty_option;
 	    buf->b_p_inc = empty_option;
diff -r 30042ddff503 src/option.h
--- a/src/option.h	Tue Oct 13 23:30:05 2015 +0200
+++ b/src/option.h	Fri Nov 06 16:32:10 2015 -0800
@@ -804,6 +804,14 @@
 #define SWB_NEWTAB		0x008
 #define SWB_VSPLIT		0x010
 EXTERN int	p_tbs;		/* 'tagbsearch' */
+EXTERN char_u	*p_tc;		/* 'tagcase' */
+EXTERN unsigned tc_flags;       /* flags from 'tagcase' */
+#ifdef IN_OPTION_C
+static char *(p_tc_values[]) = {"followic", "ignore", "match", NULL};
+#endif
+#define TC_FOLLOWIC		0x01
+#define TC_IGNORE		0x02
+#define TC_MATCH		0x04
 EXTERN long	p_tl;		/* 'taglength' */
 EXTERN int	p_tr;		/* 'tagrelative' */
 EXTERN char_u	*p_tags;	/* 'tags' */
@@ -1065,6 +1073,7 @@
     , BV_SW
     , BV_SWF
     , BV_TAGS
+    , BV_TC
     , BV_TS
     , BV_TW
     , BV_TX
diff -r 30042ddff503 src/structs.h
--- a/src/structs.h	Tue Oct 13 23:30:05 2015 +0200
+++ b/src/structs.h	Fri Nov 06 16:32:10 2015 -0800
@@ -1674,6 +1674,8 @@
     char_u	*b_p_path;	/* 'path' local value */
     int		b_p_ar;		/* 'autoread' local value */
     char_u	*b_p_tags;	/* 'tags' local value */
+    char_u	*b_p_tc;	/* 'tagcase' local value */
+    unsigned	b_tc_flags;     /* flags for 'tagcase' */
 #ifdef FEAT_INS_EXPAND
     char_u	*b_p_dict;	/* 'dictionary' local value */
     char_u	*b_p_tsr;	/* 'thesaurus' local value */
diff -r 30042ddff503 src/tag.c
--- a/src/tag.c	Tue Oct 13 23:30:05 2015 +0200
+++ b/src/tag.c	Fri Nov 06 16:32:10 2015 -0800
@@ -1385,6 +1385,18 @@
     int		use_cscope = (flags & TAG_CSCOPE);
 #endif
     int		verbose = (flags & TAG_VERBOSE);
+    int		save_p_ic = p_ic;
+
+    /*
+     * Change the value of 'ignorecase' according to 'tagcase' for the
+     * duration of this function.
+     */
+    switch (curbuf->b_tc_flags ? curbuf->b_tc_flags : tc_flags)
+    {
+	case TC_FOLLOWIC:               break;
+	case TC_IGNORE:   p_ic = TRUE;  break;
+	case TC_MATCH:    p_ic = FALSE; break;
+    }
 
     help_save = curbuf->b_help;
     orgpat.pat = pat;
@@ -2552,6 +2564,8 @@
     vim_free(saved_pat);
 #endif
 
+    p_ic = save_p_ic;
+
     return retval;
 }
 
diff -r 30042ddff503 src/testdir/Make_amiga.mak
--- a/src/testdir/Make_amiga.mak	Tue Oct 13 23:30:05 2015 +0200
+++ b/src/testdir/Make_amiga.mak	Fri Nov 06 16:32:10 2015 -0800
@@ -66,6 +66,7 @@
 		test_search_mbyte.out \
 		test_set.out \
 		test_signs.out \
+		test_tagcase.out \
 		test_textobjects.out \
 		test_utf8.out
 
@@ -221,5 +222,6 @@
 test_search_mbyte.out: test_search_mbyte.in
 test_set.out: test_set.in
 test_signs.out: test_signs.in
+test_tagcase.out: test_tagcase.in
 test_textobjects.out: test_textobjects.in
 test_utf8.out: test_utf8.in
diff -r 30042ddff503 src/testdir/Make_dos.mak
--- a/src/testdir/Make_dos.mak	Tue Oct 13 23:30:05 2015 +0200
+++ b/src/testdir/Make_dos.mak	Fri Nov 06 16:32:10 2015 -0800
@@ -65,6 +65,7 @@
 		test_search_mbyte.out \
 		test_set.out \
 		test_signs.out \
+		test_tagcase.out \
 		test_textobjects.out \
 		test_utf8.out
 
diff -r 30042ddff503 src/testdir/Make_ming.mak
--- a/src/testdir/Make_ming.mak	Tue Oct 13 23:30:05 2015 +0200
+++ b/src/testdir/Make_ming.mak	Fri Nov 06 16:32:10 2015 -0800
@@ -87,6 +87,7 @@
 		test_search_mbyte.out \
 		test_set.out \
 		test_signs.out \
+		test_tagcase.out \
 		test_textobjects.out \
 		test_utf8.out
 
diff -r 30042ddff503 src/testdir/Make_os2.mak
--- a/src/testdir/Make_os2.mak	Tue Oct 13 23:30:05 2015 +0200
+++ b/src/testdir/Make_os2.mak	Fri Nov 06 16:32:10 2015 -0800
@@ -67,6 +67,7 @@
 		test_search_mbyte.out \
 		test_set.out \
 		test_signs.out \
+		test_tagcase.out \
 		test_textobjects.out \
 		test_utf8.out
 
diff -r 30042ddff503 src/testdir/Make_vms.mms
--- a/src/testdir/Make_vms.mms	Tue Oct 13 23:30:05 2015 +0200
+++ b/src/testdir/Make_vms.mms	Fri Nov 06 16:32:10 2015 -0800
@@ -126,6 +126,7 @@
 	 test_search_mbyte.out \
 	 test_set.out \
 	 test_signs.out \
+	 test_tagcase.out \
 	 test_textobjects.out \
 	 test_utf8.out
 
diff -r 30042ddff503 src/testdir/Makefile
--- a/src/testdir/Makefile	Tue Oct 13 23:30:05 2015 +0200
+++ b/src/testdir/Makefile	Fri Nov 06 16:32:10 2015 -0800
@@ -63,6 +63,7 @@
 		test_search_mbyte.out \
 		test_set.out \
 		test_signs.out \
+		test_tagcase.out \
 		test_textobjects.out \
 		test_utf8.out
 
diff -r 30042ddff503 src/testdir/test_tagcase.in
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/testdir/test_tagcase.in	Fri Nov 06 16:32:10 2015 -0800
@@ -0,0 +1,55 @@
+Tests for 'tagcase' option
+
+STARTTEST
+:/^start text$/+1,/^end text$/w! Xtext
+:/^start tags$/+1,/^end tags$/-1w! Xtags
+:set tags=Xtags
+:e Xtext
+:"
+:" Verify default values.
+:set ic& | setg tc& | setl tc&
+:call append('$', "ic=".&ic." g:tc=".&g:tc." l:tc=".&l:tc." tc=".&tc)
+:"
+:" Verify that the local setting accepts <empty> but that the global setting
+:" does not.  The first of these (setting the local value to <empty>) should
+:" succeed; the other two should fail.
+:let v:errmsg = ""
+:setl tc=
+:call append('$', v:errmsg)
+:let v:errmsg = ""
+:setg tc=
+:call append('$', v:errmsg)
+:let v:errmsg = ""
+:set tc=
+:call append('$', v:errmsg)
+:"
+:" Verify that the correct number of matching tags is found for all values of
+:" 'ignorecase' and global and local values 'tagcase', in all combinations.
+:for &ic in [0, 1]
+:  for &g:tc in ["followic", "ignore", "match"]
+:    for &l:tc in ["", "followic", "ignore", "match"]
+:      call append('$', "ic=".&ic." g:tc=".&g:tc." l:tc=".&l:tc." tc=".&tc)
+:      call append('$', len(taglist("^foo$")))
+:      call append('$', len(taglist("^Foo$")))
+:    endfor
+:  endfor
+:endfor
+:"
+:1,/^end text$/d
+:w! test.out
+:qa!
+ENDTEST
+
+start text
+
+Foo
+Bar
+foo
+
+end text
+
+start tags
+Bar	Xtext	3
+Foo	Xtext	2
+foo	Xtext	4
+end tags
diff -r 30042ddff503 src/testdir/test_tagcase.ok
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/testdir/test_tagcase.ok	Fri Nov 06 16:32:10 2015 -0800
@@ -0,0 +1,76 @@
+ic=0 g:tc=followic l:tc=followic tc=followic
+
+E474: Invalid argument: tc=
+E474: Invalid argument: tc=
+ic=0 g:tc=followic l:tc= tc=followic
+1
+1
+ic=0 g:tc=followic l:tc=followic tc=followic
+1
+1
+ic=0 g:tc=followic l:tc=ignore tc=ignore
+2
+2
+ic=0 g:tc=followic l:tc=match tc=match
+1
+1
+ic=0 g:tc=ignore l:tc= tc=ignore
+2
+2
+ic=0 g:tc=ignore l:tc=followic tc=followic
+1
+1
+ic=0 g:tc=ignore l:tc=ignore tc=ignore
+2
+2
+ic=0 g:tc=ignore l:tc=match tc=match
+1
+1
+ic=0 g:tc=match l:tc= tc=match
+1
+1
+ic=0 g:tc=match l:tc=followic tc=followic
+1
+1
+ic=0 g:tc=match l:tc=ignore tc=ignore
+2
+2
+ic=0 g:tc=match l:tc=match tc=match
+1
+1
+ic=1 g:tc=followic l:tc= tc=followic
+2
+2
+ic=1 g:tc=followic l:tc=followic tc=followic
+2
+2
+ic=1 g:tc=followic l:tc=ignore tc=ignore
+2
+2
+ic=1 g:tc=followic l:tc=match tc=match
+1
+1
+ic=1 g:tc=ignore l:tc= tc=ignore
+2
+2
+ic=1 g:tc=ignore l:tc=followic tc=followic
+2
+2
+ic=1 g:tc=ignore l:tc=ignore tc=ignore
+2
+2
+ic=1 g:tc=ignore l:tc=match tc=match
+1
+1
+ic=1 g:tc=match l:tc= tc=match
+1
+1
+ic=1 g:tc=match l:tc=followic tc=followic
+2
+2
+ic=1 g:tc=match l:tc=ignore tc=ignore
+2
+2
+ic=1 g:tc=match l:tc=match tc=match
+1
+1

Raspunde prin e-mail lui