@@ -742,7 +742,7 @@ do_tag(
742742 /* skip backslash used for escaping a command char or
743743 * a backslash */
744744 if (* p == '\\' && (* (p + 1 ) == * tagp .command
745- || * (p + 1 ) == '\\' ))
745+ || * (p + 1 ) == '\\' ))
746746 ++ p ;
747747
748748 if (* p == TAB )
@@ -1356,6 +1356,7 @@ find_tags(
13561356 char_u * help_lang_find = NULL ; /* lang to be found */
13571357 char_u help_lang [3 ]; /* lang of current tags file */
13581358 char_u * saved_pat = NULL ; /* copy of pat[] */
1359+ int is_txt = FALSE; /* flag of file extension */
13591360#endif
13601361
13611362 pat_T orgpat ; /* holds unconverted pattern info */
@@ -1388,7 +1389,7 @@ find_tags(
13881389 */
13891390 switch (curbuf -> b_tc_flags ? curbuf -> b_tc_flags : tc_flags )
13901391 {
1391- case TC_FOLLOWIC : break ;
1392+ case TC_FOLLOWIC : break ;
13921393 case TC_IGNORE : p_ic = TRUE; break ;
13931394 case TC_MATCH : p_ic = FALSE; break ;
13941395 case TC_FOLLOWSCS : p_ic = ignorecase (pat ); break ;
@@ -1476,6 +1477,15 @@ find_tags(
14761477 * When the tag file is case-fold sorted, it is either one or the other.
14771478 * Only ignore case when TAG_NOIC not used or 'ignorecase' set.
14781479 */
1480+ #ifdef FEAT_MULTI_LANG
1481+ /* Set a flag if the file extension is .txt */
1482+ if ((flags & TAG_KEEP_LANG )
1483+ && help_lang_find == NULL
1484+ && curbuf -> b_fname != NULL
1485+ && (i = (int )STRLEN (curbuf -> b_fname )) > 4
1486+ && STRICMP (curbuf -> b_fname + i - 4 , ".txt" ) == 0 )
1487+ is_txt = TRUE;
1488+ #endif
14791489#ifdef FEAT_TAG_BINS
14801490 orgpat .regmatch .rm_ic = ((p_ic || !noic )
14811491 && (findall || orgpat .headlen == 0 || !p_tbs ));
@@ -1509,14 +1519,19 @@ find_tags(
15091519#ifdef FEAT_MULTI_LANG
15101520 if (curbuf -> b_help )
15111521 {
1512- /* Prefer help tags according to 'helplang'. Put the
1513- * two-letter language name in help_lang[]. */
1514- i = (int )STRLEN (tag_fname );
1515- if (i > 3 && tag_fname [i - 3 ] == '-' )
1516- STRCPY (help_lang , tag_fname + i - 2 );
1517- else
1522+ /* Keep en if the file extension is .txt*/
1523+ if (is_txt )
15181524 STRCPY (help_lang , "en" );
1519-
1525+ else
1526+ {
1527+ /* Prefer help tags according to 'helplang'. Put the
1528+ * two-letter language name in help_lang[]. */
1529+ i = (int )STRLEN (tag_fname );
1530+ if (i > 3 && tag_fname [i - 3 ] == '-' )
1531+ STRCPY (help_lang , tag_fname + i - 2 );
1532+ else
1533+ STRCPY (help_lang , "en" );
1534+ }
15201535 /* When searching for a specific language skip tags files
15211536 * for other languages. */
15221537 if (help_lang_find != NULL
0 commit comments