comparison 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
comparison
equal deleted inserted replaced
9069:a967b144db12 9070:0bb25b026fc9
4517 for (i = 0; i < num_file; ++i) 4517 for (i = 0; i < num_file; ++i)
4518 { 4518 {
4519 len = (int)STRLEN(file[i]) - 3; 4519 len = (int)STRLEN(file[i]) - 3;
4520 if (len <= 0) 4520 if (len <= 0)
4521 continue; 4521 continue;
4522 if (STRCMP(file[i] + len, buf) == 0) 4522 if (STRCMP(file[i] + len, "@en") == 0)
4523 {
4524 /* remove the default language */
4525 file[i][len] = NUL;
4526 }
4527 else if (STRCMP(file[i] + len, "@en") == 0)
4528 { 4523 {
4529 /* Sorting on priority means the same item in another language may 4524 /* Sorting on priority means the same item in another language may
4530 * be anywhere. Search all items for a match up to the "@en". */ 4525 * be anywhere. Search all items for a match up to the "@en". */
4531 for (j = 0; j < num_file; ++j) 4526 for (j = 0; j < num_file; ++j)
4532 if (j != i 4527 if (j != i && (int)STRLEN(file[j]) == len + 3
4533 && (int)STRLEN(file[j]) == len + 3 4528 && STRNCMP(file[i], file[j], len + 1) == 0)
4534 && STRNCMP(file[i], file[j], len + 1) == 0)
4535 break; 4529 break;
4536 if (j == num_file) 4530 if (j == num_file)
4537 /* item only exists with @en, remove it */ 4531 /* item only exists with @en, remove it */
4538 file[i][len] = NUL; 4532 file[i][len] = NUL;
4539 } 4533 }
4540 } 4534 }
4535
4536 if (*buf != NUL)
4537 for (i = 0; i < num_file; ++i)
4538 {
4539 len = (int)STRLEN(file[i]) - 3;
4540 if (len <= 0)
4541 continue;
4542 if (STRCMP(file[i] + len, buf) == 0)
4543 {
4544 /* remove the default language */
4545 file[i][len] = NUL;
4546 }
4547 }
4541 } 4548 }
4542 #endif 4549 #endif
4543 4550
4544 /* 4551 /*
4545 * Do the expansion based on xp->xp_context and "pat". 4552 * Do the expansion based on xp->xp_context and "pat".