comparison src/cmdexpand.c @ 21423:5db63c2c6929 v8.2.1262

patch 8.2.1262: src/ex_cmds.c file is too big Commit: https://github.com/vim/vim/commit/f868ba89039045b25efe83d12ca501d657e170e8 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Jul 21 21:07:20 2020 +0200 patch 8.2.1262: src/ex_cmds.c file is too big Problem: src/ex_cmds.c file is too big. Solution: Move help related code to src/help.c. (Yegappan Lakshmanan, closes #6506)
author Bram Moolenaar <Bram@vim.org>
date Tue, 21 Jul 2020 21:15:06 +0200
parents f86140ad0164
children 8a0362947c3a
comparison
equal deleted inserted replaced
21422:af29e2470306 21423:5db63c2c6929
1885 vim_free(file_str); 1885 vim_free(file_str);
1886 1886
1887 return EXPAND_OK; 1887 return EXPAND_OK;
1888 } 1888 }
1889 1889
1890 #ifdef FEAT_MULTI_LANG
1891 /*
1892 * Cleanup matches for help tags:
1893 * Remove "@ab" if the top of 'helplang' is "ab" and the language of the first
1894 * tag matches it. Otherwise remove "@en" if "en" is the only language.
1895 */
1896 static void
1897 cleanup_help_tags(int num_file, char_u **file)
1898 {
1899 int i, j;
1900 int len;
1901 char_u buf[4];
1902 char_u *p = buf;
1903
1904 if (p_hlg[0] != NUL && (p_hlg[0] != 'e' || p_hlg[1] != 'n'))
1905 {
1906 *p++ = '@';
1907 *p++ = p_hlg[0];
1908 *p++ = p_hlg[1];
1909 }
1910 *p = NUL;
1911
1912 for (i = 0; i < num_file; ++i)
1913 {
1914 len = (int)STRLEN(file[i]) - 3;
1915 if (len <= 0)
1916 continue;
1917 if (STRCMP(file[i] + len, "@en") == 0)
1918 {
1919 // Sorting on priority means the same item in another language may
1920 // be anywhere. Search all items for a match up to the "@en".
1921 for (j = 0; j < num_file; ++j)
1922 if (j != i && (int)STRLEN(file[j]) == len + 3
1923 && STRNCMP(file[i], file[j], len + 1) == 0)
1924 break;
1925 if (j == num_file)
1926 // item only exists with @en, remove it
1927 file[i][len] = NUL;
1928 }
1929 }
1930
1931 if (*buf != NUL)
1932 for (i = 0; i < num_file; ++i)
1933 {
1934 len = (int)STRLEN(file[i]) - 3;
1935 if (len <= 0)
1936 continue;
1937 if (STRCMP(file[i] + len, buf) == 0)
1938 {
1939 // remove the default language
1940 file[i][len] = NUL;
1941 }
1942 }
1943 }
1944 #endif
1945
1946 /* 1890 /*
1947 * Function given to ExpandGeneric() to obtain the possible arguments of the 1891 * Function given to ExpandGeneric() to obtain the possible arguments of the
1948 * ":behave {mswin,xterm}" command. 1892 * ":behave {mswin,xterm}" command.
1949 */ 1893 */
1950 static char_u * 1894 static char_u *