diff src/ex_getln.c @ 9070:0bb25b026fc9 v7.4.1820

commit https://github.com/vim/vim/commit/9ccaae04c6f263e6db14fc403bca2404a7871114 Author: Bram Moolenaar <Bram@vim.org> Date: Sat May 7 18:36:48 2016 +0200 patch 7.4.1820 Problem: Removing language from help tags too often. Solution: Only remove @en when not needed. (Hirohito Higashi)
author Christian Brabandt <cb@256bit.org>
date Sat, 07 May 2016 18:45:05 +0200
parents c7bdd383275d
children 636cfa97200e
line wrap: on
line diff
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -4519,25 +4519,32 @@ cleanup_help_tags(int num_file, char_u *
 	len = (int)STRLEN(file[i]) - 3;
 	if (len <= 0)
 	    continue;
-	if (STRCMP(file[i] + len, buf) == 0)
-	{
-	    /* remove the default language */
-	    file[i][len] = NUL;
-	}
-	else if (STRCMP(file[i] + len, "@en") == 0)
+	if (STRCMP(file[i] + len, "@en") == 0)
 	{
 	    /* Sorting on priority means the same item in another language may
 	     * be anywhere.  Search all items for a match up to the "@en". */
 	    for (j = 0; j < num_file; ++j)
-		if (j != i
-			&& (int)STRLEN(file[j]) == len + 3
-			&& STRNCMP(file[i], file[j], len + 1) == 0)
+		if (j != i && (int)STRLEN(file[j]) == len + 3
+			   && STRNCMP(file[i], file[j], len + 1) == 0)
 		    break;
 	    if (j == num_file)
 		/* item only exists with @en, remove it */
 		file[i][len] = NUL;
 	}
     }
+
+    if (*buf != NUL)
+	for (i = 0; i < num_file; ++i)
+	{
+	    len = (int)STRLEN(file[i]) - 3;
+	    if (len <= 0)
+		continue;
+	    if (STRCMP(file[i] + len, buf) == 0)
+	    {
+		/* remove the default language */
+		file[i][len] = NUL;
+	    }
+	}
 }
 #endif