From b811de5d49a23b20df82a80533d0602cda49029e Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 21 Oct 2021 10:50:44 +0100 Subject: [PATCH 01/15] patch 8.2.3549: mistakes in test comments Problem: Mistakes in test comments. Solution: Fix the comments. (closes #9029) --- src/testdir/test_autocmd.vim | 36 ++++++++++++++++++------------------ src/version.c | 2 ++ 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/src/testdir/test_autocmd.vim b/src/testdir/test_autocmd.vim index 3893b79a65..8161183dc8 100644 --- a/src/testdir/test_autocmd.vim +++ b/src/testdir/test_autocmd.vim @@ -760,33 +760,33 @@ func Test_OptionSet() call assert_equal(g:opt[0], g:opt[1]) - " 19a: Setting string local-global (to buffer) option" + " 19a: Setting string global-local (to buffer) option" let oldval = &tags let g:options = [['tags', oldval, oldval, oldval, 'tagpath', 'global', 'set']] set tags=tagpath call assert_equal([], g:options) call assert_equal(g:opt[0], g:opt[1]) - " 19b: Resetting string local-global (to buffer) option" + " 19b: Resetting string global-local (to buffer) option" let g:options = [['tags', 'tagpath', 'tagpath', 'tagpath', oldval, 'global', 'set']] set tags& call assert_equal([], g:options) call assert_equal(g:opt[0], g:opt[1]) - " 19c: Setting global string local-global (to buffer) option " + " 19c: Setting global string global-local (to buffer) option " let g:options = [['tags', oldval, '', oldval, 'tagpath1', 'global', 'setglobal']] setglobal tags=tagpath1 call assert_equal([], g:options) call assert_equal(g:opt[0], g:opt[1]) - " 19d: Setting local string local-global (to buffer) option" + " 19d: Setting local string global-local (to buffer) option" let g:options = [['tags', 'tagpath1', 'tagpath1', '', 'tagpath2', 'local', 'setlocal']] setlocal tags=tagpath2 call assert_equal([], g:options) call assert_equal(g:opt[0], g:opt[1]) - " 19e: Setting again string local-global (to buffer) option" - " Note: v:option_old is the old global value for local-global string options + " 19e: Setting again string global-local (to buffer) option" + " Note: v:option_old is the old global value for global-local string options " but the old local value for all other kinds of options. noa setglobal tags=tag_global " Reset global and local value (without triggering autocmd) noa setlocal tags=tag_local @@ -795,8 +795,8 @@ func Test_OptionSet() call assert_equal([], g:options) call assert_equal(g:opt[0], g:opt[1]) - " 19f: Setting string local-global (to buffer) option to an empty string" - " Note: v:option_old is the old global value for local-global string options + " 19f: Setting string global-local (to buffer) option to an empty string" + " Note: v:option_old is the old global value for global-local string options " but the old local value for all other kinds of options. noa set tags=tag_global " Reset global and local value (without triggering autocmd) noa setlocal tags= " empty string @@ -833,7 +833,7 @@ func Test_OptionSet() call assert_equal(g:opt[0], g:opt[1]) " 20e: Setting again string local (to buffer) option" - " Note: v:option_old is the old global value for local-global string options + " Note: v:option_old is the old global value for global-local string options " but the old local value for all other kinds of options. noa setglobal spelllang=spellglobal " Reset global and local value (without triggering autocmd) noa setlocal spelllang=spelllocal @@ -843,36 +843,36 @@ func Test_OptionSet() call assert_equal(g:opt[0], g:opt[1]) - " 21a: Setting string local-global (to window) option" + " 21a: Setting string global-local (to window) option" let oldval = &statusline let g:options = [['statusline', oldval, oldval, oldval, 'foo', 'global', 'set']] set statusline=foo call assert_equal([], g:options) call assert_equal(g:opt[0], g:opt[1]) - " 21b: Resetting string local-global (to window) option" - " Note: v:option_old is the old global value for local-global string options + " 21b: Resetting string global-local (to window) option" + " Note: v:option_old is the old global value for global-local string options " but the old local value for all other kinds of options. let g:options = [['statusline', 'foo', 'foo', 'foo', oldval, 'global', 'set']] set statusline& call assert_equal([], g:options) call assert_equal(g:opt[0], g:opt[1]) - " 21c: Setting global string local-global (to window) option" + " 21c: Setting global string global-local (to window) option" let g:options = [['statusline', oldval, '', oldval, 'bar', 'global', 'setglobal']] setglobal statusline=bar call assert_equal([], g:options) call assert_equal(g:opt[0], g:opt[1]) - " 21d: Setting local string local-global (to window) option" + " 21d: Setting local string global-local (to window) option" noa set statusline& " Reset global and local value (without triggering autocmd) let g:options = [['statusline', oldval, oldval, '', 'baz', 'local', 'setlocal']] setlocal statusline=baz call assert_equal([], g:options) call assert_equal(g:opt[0], g:opt[1]) - " 21e: Setting again string local-global (to window) option" - " Note: v:option_old is the old global value for local-global string options + " 21e: Setting again string global-local (to window) option" + " Note: v:option_old is the old global value for global-local string options " but the old local value for all other kinds of options. noa setglobal statusline=bar " Reset global and local value (without triggering autocmd) noa setlocal statusline=baz @@ -917,7 +917,7 @@ func Test_OptionSet() call assert_equal(g:opt[0], g:opt[1]) - " 23a: Setting global number local option" + " 23a: Setting global number global option" noa setglobal cmdheight=8 " Reset global and local value (without triggering autocmd) noa setlocal cmdheight=1 " Sets the global(!) value! let g:options = [['cmdheight', '1', '', '1', '2', 'global', 'setglobal']] @@ -1041,7 +1041,7 @@ func Test_OptionSet() call assert_equal([], g:options) call assert_equal(g:opt[0], g:opt[1]) - " 27d: Ssettin again global number local (to window) option" + " 27d: Setting again global number local (to window) option" noa set foldcolumn=8 " Reset global and local value (without triggering autocmd) let g:options = [['foldcolumn', '8', '8', '8', '2', 'global', 'set']] set foldcolumn=2 diff --git a/src/version.c b/src/version.c index 1e7fb75cab..5df626a970 100644 --- a/src/version.c +++ b/src/version.c @@ -757,6 +757,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 3549, /**/ 3548, /**/ From ae38a9db7770b38889fbf06908cc69d42b463a73 Mon Sep 17 00:00:00 2001 From: Shougo Matsushita Date: Thu, 21 Oct 2021 11:39:53 +0100 Subject: [PATCH 02/15] patch 8.2.3550: completion() does not work properly Problem: completion() does not work properly. Solution: Set xp_line and add WILD_HOME_REPLACE. (Shougo Matsushita, closes #9016) --- src/cmdexpand.c | 3 ++- src/testdir/test_cmdline.vim | 15 +++++++++++++++ src/version.c | 2 ++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/cmdexpand.c b/src/cmdexpand.c index c98e126a5c..71c4f690cb 100644 --- a/src/cmdexpand.c +++ b/src/cmdexpand.c @@ -978,6 +978,7 @@ set_one_cmd_context( ExpandInit(xp); xp->xp_pattern = buff; + xp->xp_line = buff; xp->xp_context = EXPAND_COMMANDS; // Default until we get past command ea.argt = 0; @@ -2891,7 +2892,7 @@ f_getcompletion(typval_T *argvars, typval_T *rettv) expand_T xpc; int filtered = FALSE; int options = WILD_SILENT | WILD_USE_NL | WILD_ADD_SLASH - | WILD_NO_BEEP; + | WILD_NO_BEEP | WILD_HOME_REPLACE; if (in_vim9script() && (check_for_string_arg(argvars, 0) == FAIL diff --git a/src/testdir/test_cmdline.vim b/src/testdir/test_cmdline.vim index 9c21a205f7..87ae6faa2f 100644 --- a/src/testdir/test_cmdline.vim +++ b/src/testdir/test_cmdline.vim @@ -305,6 +305,11 @@ func Test_getcompletion() let l = getcompletion('NoMatch', 'dir') call assert_equal([], l) + if glob('~/*') !=# '' + let l = getcompletion('~/', 'dir') + call assert_true(l[0][0] ==# '~') + endif + let l = getcompletion('exe', 'expression') call assert_true(index(l, 'executable(') >= 0) let l = getcompletion('kill', 'expression') @@ -418,6 +423,16 @@ func Test_getcompletion() let l = getcompletion('call paint', 'cmdline') call assert_equal([], l) + func T(a, c, p) + return "oneA\noneB\noneC" + endfunc + command -nargs=1 -complete=custom,T MyCmd + let l = getcompletion('MyCmd ', 'cmdline') + call assert_equal(['oneA', 'oneB', 'oneC'], l) + + delcommand MyCmd + delfunc T + " For others test if the name is recognized. let names = ['buffer', 'environment', 'file_in_path', 'mapping', 'tag', 'tag_listfiles', 'user'] if has('cmdline_hist') diff --git a/src/version.c b/src/version.c index 5df626a970..e4f72bd672 100644 --- a/src/version.c +++ b/src/version.c @@ -757,6 +757,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 3550, /**/ 3549, /**/ From 94e7d345c156a722bb161b73238c4ba1d27ec586 Mon Sep 17 00:00:00 2001 From: itchyny Date: Thu, 21 Oct 2021 18:01:13 +0100 Subject: [PATCH 03/15] patch 8.2.3551: checking first character of url twice Problem: Checking first character of url twice. Solution: Only check once. (closes #9026) --- src/misc1.c | 2 +- src/version.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/misc1.c b/src/misc1.c index 62eba0206d..109b7bb0cf 100644 --- a/src/misc1.c +++ b/src/misc1.c @@ -2643,7 +2643,7 @@ path_with_url(char_u *fname) return 0; // check body: alpha or dash - for (p = fname; (isalpha(*p) || (*p == '-')); ++p) + for (p = fname + 1; (isalpha(*p) || (*p == '-')); ++p) ; // check last char is not a dash diff --git a/src/version.c b/src/version.c index e4f72bd672..75c35196b8 100644 --- a/src/version.c +++ b/src/version.c @@ -757,6 +757,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 3551, /**/ 3550, /**/ From 47810464aa4f9edbf222c02a860a3ec560b0b7a1 Mon Sep 17 00:00:00 2001 From: DungSaga Date: Fri, 22 Oct 2021 12:55:42 +0100 Subject: [PATCH 04/15] patch 8.2.3552: xxd revert does not handle end of line correctly Problem: Xxd revert does not handle end of line correctly. Solution: Check for newline first. (closes #9034) --- src/testdir/test_xxd.vim | 33 +++++++++++++++++++++++++++++++++ src/version.c | 2 ++ src/xxd/xxd.c | 17 ++++++++++------- 3 files changed, 45 insertions(+), 7 deletions(-) diff --git a/src/testdir/test_xxd.vim b/src/testdir/test_xxd.vim index 922c5ab3a6..fec0122127 100644 --- a/src/testdir/test_xxd.vim +++ b/src/testdir/test_xxd.vim @@ -213,6 +213,39 @@ func Test_xxd() call delete('XXDfile') endfunc +func Test_xxd_patch() + let cmd = 'silent !' .. s:xxd_cmd .. ' -r Xxxdin Xxxdfile; ' .. s:xxd_cmd .. ' -g1 Xxxdfile > Xxxdout' + call writefile(["2: 41 41", "8: 42 42"], 'Xxxdin') + call writefile(['::::::::'], 'Xxxdfile') + exe cmd + call assert_equal(['00000000: 3a 3a 41 41 3a 3a 3a 3a 42 42 ::AA::::BB'], readfile('Xxxdout')) + + call writefile(["2: 43 43 ", "8: 44 44"], 'Xxxdin') + exe cmd + call assert_equal(['00000000: 3a 3a 43 43 3a 3a 3a 3a 44 44 ::CC::::DD'], readfile('Xxxdout')) + + call writefile(["2: 45 45 ", "8: 46 46"], 'Xxxdin') + exe cmd + call assert_equal(['00000000: 3a 3a 45 45 3a 3a 3a 3a 46 46 ::EE::::FF'], readfile('Xxxdout')) + + call writefile(["2: 41 41", "08: 42 42"], 'Xxxdin') + call writefile(['::::::::'], 'Xxxdfile') + exe cmd + call assert_equal(['00000000: 3a 3a 41 41 3a 3a 3a 3a 42 42 ::AA::::BB'], readfile('Xxxdout')) + + call writefile(["2: 43 43 ", "09: 44 44"], 'Xxxdin') + exe cmd + call assert_equal(['00000000: 3a 3a 43 43 3a 3a 3a 3a 42 44 44 ::CC::::BDD'], readfile('Xxxdout')) + + call writefile(["2: 45 45 ", "0a: 46 46"], 'Xxxdin') + exe cmd + call assert_equal(['00000000: 3a 3a 45 45 3a 3a 3a 3a 42 44 46 46 ::EE::::BDFF'], readfile('Xxxdout')) + + call delete('Xxxdin') + call delete('Xxxdfile') + call delete('Xxxdout') +endfunc + " Various ways with wrong arguments that trigger the usage output. func Test_xxd_usage() for arg in ['-c', '-g', '-o', '-s', '-l', '-X', 'one two three'] diff --git a/src/version.c b/src/version.c index 75c35196b8..01437619b8 100644 --- a/src/version.c +++ b/src/version.c @@ -757,6 +757,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 3552, /**/ 3551, /**/ diff --git a/src/xxd/xxd.c b/src/xxd/xxd.c index 749df435d2..e9dab81fbc 100644 --- a/src/xxd/xxd.c +++ b/src/xxd/xxd.c @@ -131,7 +131,7 @@ extern void perror __P((char *)); extern long int strtol(); extern long int ftell(); -char version[] = "xxd 2020-02-04 by Juergen Weigert et al."; +char version[] = "xxd 2021-10-22 by Juergen Weigert et al."; #ifdef WIN32 char osver[] = " (Win32)"; #else @@ -318,8 +318,7 @@ huntype( if (fflush(fpo) != 0) die(3); #ifdef TRY_SEEK - c = fseek(fpo, base_off + want_off - have_off, 1); - if (c >= 0) + if (fseek(fpo, base_off + want_off - have_off, 1) >= 0) have_off = base_off + want_off; #endif if (base_off + want_off < have_off) @@ -349,12 +348,16 @@ huntype( if (n1 < 0 && n2 < 0 && n3 < 0) { /* already stumbled into garbage, skip line, wait and see */ - if (!hextype) - want_off = 0; - while ((c = getc(fpi)) != '\n' && c != EOF) - ; + while (c != '\n' && c != EOF) + c = getc(fpi); if (c == EOF && ferror(fpi)) die(2); + } + if (c == '\n') + { + if (!hextype) + want_off = 0; + p = cols; ign_garb = 1; } } From 5a5c111e79d1ea4b24133eaf44deab42a8e78eed Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 22 Oct 2021 15:11:37 +0100 Subject: [PATCH 05/15] patch 8.2.3553: xxd test fails on MS-Windows Problem: Xxd test fails on MS-Windows. Solution: Split shell command in two. --- src/testdir/test_xxd.vim | 21 ++++++++++++++------- src/version.c | 2 ++ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/testdir/test_xxd.vim b/src/testdir/test_xxd.vim index fec0122127..7768f90442 100644 --- a/src/testdir/test_xxd.vim +++ b/src/testdir/test_xxd.vim @@ -214,31 +214,38 @@ func Test_xxd() endfunc func Test_xxd_patch() - let cmd = 'silent !' .. s:xxd_cmd .. ' -r Xxxdin Xxxdfile; ' .. s:xxd_cmd .. ' -g1 Xxxdfile > Xxxdout' + let cmd1 = 'silent !' .. s:xxd_cmd .. ' -r Xxxdin Xxxdfile' + let cmd2 = 'silent !' .. s:xxd_cmd .. ' -g1 Xxxdfile > Xxxdout' call writefile(["2: 41 41", "8: 42 42"], 'Xxxdin') call writefile(['::::::::'], 'Xxxdfile') - exe cmd + exe cmd1 + exe cmd2 call assert_equal(['00000000: 3a 3a 41 41 3a 3a 3a 3a 42 42 ::AA::::BB'], readfile('Xxxdout')) call writefile(["2: 43 43 ", "8: 44 44"], 'Xxxdin') - exe cmd + exe cmd1 + exe cmd2 call assert_equal(['00000000: 3a 3a 43 43 3a 3a 3a 3a 44 44 ::CC::::DD'], readfile('Xxxdout')) call writefile(["2: 45 45 ", "8: 46 46"], 'Xxxdin') - exe cmd + exe cmd1 + exe cmd2 call assert_equal(['00000000: 3a 3a 45 45 3a 3a 3a 3a 46 46 ::EE::::FF'], readfile('Xxxdout')) call writefile(["2: 41 41", "08: 42 42"], 'Xxxdin') call writefile(['::::::::'], 'Xxxdfile') - exe cmd + exe cmd1 + exe cmd2 call assert_equal(['00000000: 3a 3a 41 41 3a 3a 3a 3a 42 42 ::AA::::BB'], readfile('Xxxdout')) call writefile(["2: 43 43 ", "09: 44 44"], 'Xxxdin') - exe cmd + exe cmd1 + exe cmd2 call assert_equal(['00000000: 3a 3a 43 43 3a 3a 3a 3a 42 44 44 ::CC::::BDD'], readfile('Xxxdout')) call writefile(["2: 45 45 ", "0a: 46 46"], 'Xxxdin') - exe cmd + exe cmd1 + exe cmd2 call assert_equal(['00000000: 3a 3a 45 45 3a 3a 3a 3a 42 44 46 46 ::EE::::BDFF'], readfile('Xxxdout')) call delete('Xxxdin') diff --git a/src/version.c b/src/version.c index 01437619b8..8babe70171 100644 --- a/src/version.c +++ b/src/version.c @@ -757,6 +757,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 3553, /**/ 3552, /**/ From a2ffb435209716dc7aeb4783333f6ea19f5d28a7 Mon Sep 17 00:00:00 2001 From: DungSaga Date: Fri, 22 Oct 2021 15:55:31 +0100 Subject: [PATCH 06/15] patch 8.2.3554: xxd has various way to exit Problem: Xxd has various way to exit. Solution: Add function to print error and exit. (closes #9035) --- src/version.c | 2 + src/xxd/xxd.c | 108 +++++++++++++++++++++----------------------------- 2 files changed, 48 insertions(+), 62 deletions(-) diff --git a/src/version.c b/src/version.c index 8babe70171..16a290ba77 100644 --- a/src/version.c +++ b/src/version.c @@ -757,6 +757,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 3554, /**/ 3553, /**/ diff --git a/src/xxd/xxd.c b/src/xxd/xxd.c index e9dab81fbc..b6024ad96b 100644 --- a/src/xxd/xxd.c +++ b/src/xxd/xxd.c @@ -188,13 +188,6 @@ char osver[] = ""; # endif #endif -/* Let's collect some prototypes */ -/* CodeWarrior is really picky about missing prototypes */ -static void exit_with_usage __P((void)); -static void die __P((int)); -static int huntype __P((FILE *, FILE *, FILE *, int, int, long)); -static void xxdline __P((FILE *, char *, int)); - #define TRY_SEEK /* attempt to use lseek, or skip forward by reading */ #define COLS 256 /* change here, if you ever need more columns */ #define LLEN ((2*(int)sizeof(unsigned long)) + 4 + (9*COLS-1) + COLS + 2) @@ -245,13 +238,20 @@ exit_with_usage(void) } static void -die(int ret) +perror_exit(int ret) { fprintf(stderr, "%s: ", pname); perror(NULL); exit(ret); } + static void +error_exit(int ret, char *msg) +{ + fprintf(stderr, "%s: %s\n", pname, msg); + exit(ret); +} + /* * Max. cols binary characters are decoded from the input stream per line. * Two adjacent garbage characters after evaluated data delimit valid data. @@ -263,7 +263,6 @@ die(int ret) huntype( FILE *fpi, FILE *fpo, - FILE *fperr, int cols, int hextype, long base_off) @@ -316,25 +315,22 @@ huntype( if (base_off + want_off != have_off) { if (fflush(fpo) != 0) - die(3); + perror_exit(3); #ifdef TRY_SEEK if (fseek(fpo, base_off + want_off - have_off, 1) >= 0) have_off = base_off + want_off; #endif if (base_off + want_off < have_off) - { - fprintf(fperr, "%s: sorry, cannot seek backwards.\n", pname); - return 5; - } + error_exit(5, "sorry, cannot seek backwards."); for (; have_off < base_off + want_off; have_off++) if (putc(0, fpo) == EOF) - die(3); + perror_exit(3); } if (n2 >= 0 && n1 >= 0) { if (putc((n2 << 4) | n1, fpo) == EOF) - die(3); + perror_exit(3); have_off++; want_off++; n1 = -1; @@ -351,7 +347,7 @@ huntype( while (c != '\n' && c != EOF) c = getc(fpi); if (c == EOF && ferror(fpi)) - die(2); + perror_exit(2); } if (c == '\n') { @@ -362,14 +358,14 @@ huntype( } } if (fflush(fpo) != 0) - die(3); + perror_exit(3); #ifdef TRY_SEEK fseek(fpo, 0L, 2); #endif if (fclose(fpo) != 0) - die(3); + perror_exit(3); if (fclose(fpi) != 0) - die(2); + perror_exit(2); return 0; } @@ -402,14 +398,14 @@ xxdline(FILE *fp, char *l, int nz) zero_seen--; if (zero_seen == 2) if (fputs(z, fp) == EOF) - die(3); + perror_exit(3); if (zero_seen > 2) if (fputs("*\n", fp) == EOF) - die(3); + perror_exit(3); } if (nz >= 0 || zero_seen > 0) if (fputs(l, fp) == EOF) - die(3); + perror_exit(3); if (nz) zero_seen = 0; } @@ -640,12 +636,7 @@ main(int argc, char *argv[]) if (octspergrp < 1 || octspergrp > cols) octspergrp = cols; else if (hextype == HEX_LITTLEENDIAN && (octspergrp & (octspergrp-1))) - { - fprintf(stderr, - "%s: number of octets per group must be a power of 2 with -e.\n", - pname); - exit(1); - } + error_exit(1, "number of octets per group must be a power of 2 with -e."); if (argc > 3) exit_with_usage(); @@ -682,11 +673,8 @@ main(int argc, char *argv[]) if (revert) { if (hextype && (hextype != HEX_POSTSCRIPT)) - { - fprintf(stderr, "%s: sorry, cannot revert this type of hexdump\n", pname); - return -1; - } - return huntype(fp, fpo, stderr, cols, hextype, + error_exit(-1, "sorry, cannot revert this type of hexdump"); + return huntype(fp, fpo, cols, hextype, negseek ? -seekoff : seekoff); } @@ -698,10 +686,7 @@ main(int argc, char *argv[]) else e = fseek(fp, negseek ? -seekoff : seekoff, negseek ? 2 : 0); if (e < 0 && negseek) - { - fprintf(stderr, "%s: sorry cannot seek.\n", pname); - return 4; - } + error_exit(4, "sorry cannot seek."); if (e >= 0) seekoff = ftell(fp); else @@ -714,12 +699,11 @@ main(int argc, char *argv[]) { if (ferror(fp)) { - die(2); + perror_exit(2); } else { - fprintf(stderr, "%s: sorry cannot seek.\n", pname); - return 4; + error_exit(4, "sorry cannot seek."); } } } @@ -730,12 +714,12 @@ main(int argc, char *argv[]) if (fp != stdin) { if (fprintf(fpo, "unsigned char %s", isdigit((int)argv[1][0]) ? "__" : "") < 0) - die(3); + perror_exit(3); for (e = 0; (c = argv[1][e]) != 0; e++) if (putc(isalnum(c) ? CONDITIONAL_CAPITALIZE(c) : '_', fpo) == EOF) - die(3); + perror_exit(3); if (fputs("[] = {\n", fpo) == EOF) - die(3); + perror_exit(3); } p = 0; @@ -744,32 +728,32 @@ main(int argc, char *argv[]) { if (fprintf(fpo, (hexx == hexxa) ? "%s0x%02x" : "%s0X%02X", (p % cols) ? ", " : &",\n "[2*!p], c) < 0) - die(3); + perror_exit(3); p++; } if (c == EOF && ferror(fp)) - die(2); + perror_exit(2); if (p && fputs("\n", fpo) == EOF) - die(3); + perror_exit(3); if (fputs(&"};\n"[3 * (fp == stdin)], fpo) == EOF) - die(3); + perror_exit(3); if (fp != stdin) { if (fprintf(fpo, "unsigned int %s", isdigit((int)argv[1][0]) ? "__" : "") < 0) - die(3); + perror_exit(3); for (e = 0; (c = argv[1][e]) != 0; e++) if (putc(isalnum(c) ? CONDITIONAL_CAPITALIZE(c) : '_', fpo) == EOF) - die(3); + perror_exit(3); if (fprintf(fpo, "_%s = %d;\n", capitalize ? "LEN" : "len", p) < 0) - die(3); + perror_exit(3); } if (fclose(fp)) - die(2); + perror_exit(2); if (fclose(fpo)) - die(3); + perror_exit(3); return 0; } @@ -781,24 +765,24 @@ main(int argc, char *argv[]) { if (putc(hexx[(e >> 4) & 0xf], fpo) == EOF || putc(hexx[e & 0xf], fpo) == EOF) - die(3); + perror_exit(3); n++; if (!--p) { if (putc('\n', fpo) == EOF) - die(3); + perror_exit(3); p = cols; } } if (e == EOF && ferror(fp)) - die(2); + perror_exit(2); if (p < cols) if (putc('\n', fpo) == EOF) - die(3); + perror_exit(3); if (fclose(fp)) - die(2); + perror_exit(2); if (fclose(fpo)) - die(3); + perror_exit(3); return 0; } @@ -863,7 +847,7 @@ main(int argc, char *argv[]) } } if (e == EOF && ferror(fp)) - die(2); + perror_exit(2); if (p) { l[c = (addrlen + 3 + (grplen * cols - 1)/octspergrp + p)] = '\n'; l[++c] = '\0'; @@ -873,9 +857,9 @@ main(int argc, char *argv[]) xxdline(fpo, l, -1); /* last chance to flush out suppressed lines */ if (fclose(fp)) - die(2); + perror_exit(2); if (fclose(fpo)) - die(3); + perror_exit(3); return 0; } From 25def2c8b8bd7b0c3d5f020207c717a880b05d50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=3D=3FUTF-8=3Fq=3FMagnus=3D20Gro=3DC3=3D9F=3F=3D?= Date: Fri, 22 Oct 2021 18:56:39 +0100 Subject: [PATCH 07/15] patch 8.2.3555: ModeChanged is not triggered on every mode change Problem: ModeChanged is not triggered on every mode change. Solution: Also trigger on minor mode changes. (Maguns Gross, closes #8999) --- runtime/doc/autocmd.txt | 13 ++++++++---- src/autocmd.c | 17 +++++++++++++++ src/insexpand.c | 7 +++++++ src/misc1.c | 11 +++++++--- src/normal.c | 7 ++++++- src/terminal.c | 1 + src/testdir/test_edit.vim | 44 +++++++++++++++++++++++++++------------ src/version.c | 2 ++ 8 files changed, 81 insertions(+), 21 deletions(-) diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt index bcc81ecdad..6a4edf9039 100644 --- a/runtime/doc/autocmd.txt +++ b/runtime/doc/autocmd.txt @@ -930,18 +930,23 @@ MenuPopup Just before showing the popup menu (under the *ModeChanged* ModeChanged After changing the mode. The pattern is matched against `'old_mode:new_mode'`, for - example match against `i:*` to simulate - |InsertLeave|. + example match against `*:c*` to simulate + |CmdlineEnter|. The following values of |v:event| are set: old_mode The mode before it changed. new_mode The new mode as also returned - by |mode()|. + by |mode()| called with a + non-zero argument. When ModeChanged is triggered, old_mode will have the value of new_mode when the event was last triggered. + This will be triggered on every minor mode + change. Usage example to use relative line numbers when entering Visual mode: > - :autocmd ModeChanged *:v set relativenumber + :au ModeChanged [vV\x16]*:* let &l:rnu = mode() =~# '^[vV\x16]' + :au ModeChanged *:[vV\x16]* let &l:rnu = mode() =~# '^[vV\x16]' + :au WinEnter,WinLeave * let &l:rnu = mode() =~# '^[vV\x16]' < *OptionSet* OptionSet After setting an option. The pattern is matched against the long option name. diff --git a/src/autocmd.c b/src/autocmd.c index bd1ed87419..1704cd4e3a 100644 --- a/src/autocmd.c +++ b/src/autocmd.c @@ -1218,6 +1218,23 @@ do_autocmd_event( return FAIL; } +#ifdef FEAT_EVAL + // need to initialize last_mode for the first ModeChanged + // autocmd + if (event == EVENT_MODECHANGED && !has_modechanged()) + { + typval_T rettv; + typval_T tv[2]; + + tv[0].v_type = VAR_NUMBER; + tv[0].vval.v_number = 1; + tv[1].v_type = VAR_UNKNOWN; + f_mode(tv, &rettv); + STRCPY(last_mode, rettv.vval.v_string); + vim_free(rettv.vval.v_string); + } +#endif + if (is_buflocal) { ap->buflocal_nr = buflocal_nr; diff --git a/src/insexpand.c b/src/insexpand.c index 6d5e556c66..c993d96701 100644 --- a/src/insexpand.c +++ b/src/insexpand.c @@ -243,6 +243,8 @@ ins_ctrl_x(void) // CTRL-X in CTRL-X CTRL-V mode behaves differently to make CTRL-X // CTRL-V look like CTRL-N ctrl_x_mode = CTRL_X_CMDLINE_CTRL_X; + + trigger_modechanged(); } /* @@ -2150,6 +2152,8 @@ ins_compl_prep(int c) // upon the (possibly failed) completion. ins_apply_autocmds(EVENT_COMPLETEDONE); + trigger_modechanged(); + // reset continue_* if we left expansion-mode, if we stay they'll be // (re)set properly in ins_complete() if (!vim_is_ctrl_x_key(c)) @@ -2487,6 +2491,7 @@ set_completion(colnr_T startcol, list_T *list) // Lazily show the popup menu, unless we got interrupted. if (!compl_interrupted) show_pum(save_w_wrow, save_w_leftcol); + trigger_modechanged(); out_flush(); } @@ -3255,6 +3260,8 @@ ins_compl_get_exp(pos_T *ini) if (compl_curr_match == NULL) compl_curr_match = compl_old_match; } + trigger_modechanged(); + return i; } diff --git a/src/misc1.c b/src/misc1.c index 109b7bb0cf..58f515dffb 100644 --- a/src/misc1.c +++ b/src/misc1.c @@ -2670,12 +2670,17 @@ trigger_modechanged() if (!has_modechanged()) return; - v_event = get_vim_var_dict(VV_EVENT); - tv[0].v_type = VAR_NUMBER; tv[0].vval.v_number = 1; // get full mode tv[1].v_type = VAR_UNKNOWN; f_mode(tv, &rettv); + if (STRCMP(rettv.vval.v_string, last_mode) == 0) + { + vim_free(rettv.vval.v_string); + return; + } + + v_event = get_vim_var_dict(VV_EVENT); (void)dict_add_string(v_event, "new_mode", rettv.vval.v_string); (void)dict_add_string(v_event, "old_mode", last_mode); dict_set_items_ro(v_event); @@ -2688,9 +2693,9 @@ trigger_modechanged() apply_autocmds(EVENT_MODECHANGED, pat, NULL, FALSE, curbuf); STRCPY(last_mode, rettv.vval.v_string); - vim_free(rettv.vval.v_string); vim_free(pat); dict_free_contents(v_event); hash_init(&v_event->dv_hashtab); + vim_free(rettv.vval.v_string); #endif } diff --git a/src/normal.c b/src/normal.c index eafd1fddb6..e6b7a8a758 100644 --- a/src/normal.c +++ b/src/normal.c @@ -527,6 +527,7 @@ normal_cmd( # endif } #endif + trigger_modechanged(); // When not finishing an operator and no register name typed, reset the // count. @@ -1221,6 +1222,7 @@ normal_end: c = finish_op; #endif finish_op = FALSE; + trigger_modechanged(); #ifdef CURSOR_SHAPE // Redraw the cursor with another shape, if we were in Operator-pending // mode or did a replace command. @@ -1278,6 +1280,7 @@ normal_end: if (restart_VIsual_select == 1) { VIsual_select = TRUE; + trigger_modechanged(); showmode(); restart_VIsual_select = 0; } @@ -1386,7 +1389,6 @@ end_visual_mode_keep_button() #endif VIsual_active = FALSE; - trigger_modechanged(); setmouse(); mouse_dragging = 0; @@ -1403,6 +1405,7 @@ end_visual_mode_keep_button() may_clear_cmdline(); adjust_cursor_eol(); + trigger_modechanged(); } /* @@ -3439,6 +3442,7 @@ nv_ctrlg(cmdarg_T *cap) if (VIsual_active) // toggle Selection/Visual mode { VIsual_select = !VIsual_select; + trigger_modechanged(); showmode(); } else if (!checkclearop(cap->oap)) @@ -3501,6 +3505,7 @@ nv_ctrlo(cmdarg_T *cap) if (VIsual_active && VIsual_select) { VIsual_select = FALSE; + trigger_modechanged(); showmode(); restart_VIsual_select = 2; // restart Select mode later } diff --git a/src/terminal.c b/src/terminal.c index e9dd8ea166..bb3035bdfd 100644 --- a/src/terminal.c +++ b/src/terminal.c @@ -1995,6 +1995,7 @@ term_check_timers(int next_due_arg, proftime_T *now) set_terminal_mode(term_T *term, int normal_mode) { term->tl_normal_mode = normal_mode; + trigger_modechanged(); if (!normal_mode) handle_postponed_scrollback(term); VIM_CLEAR(term->tl_status_text); diff --git a/src/testdir/test_edit.vim b/src/testdir/test_edit.vim index 8e4254be4f..f0f04f0491 100644 --- a/src/testdir/test_edit.vim +++ b/src/testdir/test_edit.vim @@ -1959,12 +1959,8 @@ endfunc " Test for ModeChanged pattern func Test_mode_changes() - let g:count = 0 - func! DoIt() - let g:count += 1 - endfunc let g:index = 0 - let g:mode_seq = ['n', 'i', 'n', 'v', 'V', 'n', 'V', 'v', 'n'] + let g:mode_seq = ['n', 'i', 'n', 'v', 'V', 'i', 'ix', 'i', 'ic', 'i', 'n', 'no', 'n', 'V', 'v', 's', 'n'] func! TestMode() call assert_equal(g:mode_seq[g:index], get(v:event, "old_mode")) call assert_equal(g:mode_seq[g:index + 1], get(v:event, "new_mode")) @@ -1973,13 +1969,15 @@ func Test_mode_changes() endfunc au ModeChanged * :call TestMode() - au ModeChanged n:* :call DoIt() - call feedkeys("i\vV\", 'tnix') - call assert_equal(2, g:count) + let g:n_to_any = 0 + au ModeChanged n:* let g:n_to_any += 1 + call feedkeys("i\vVca\\\\ggdG", 'tnix') - au ModeChanged V:v :call DoIt() - call feedkeys("Vv\", 'tnix') - call assert_equal(4, g:count) + let g:V_to_v = 0 + au ModeChanged V:v let g:V_to_v += 1 + call feedkeys("Vv\\", 'tnix') + call assert_equal(len(filter(g:mode_seq[1:], {idx, val -> val == 'n'})), g:n_to_any) + call assert_equal(1, g:V_to_v) call assert_equal(len(g:mode_seq) - 1, g:index) let g:n_to_i = 0 @@ -2008,12 +2006,32 @@ func Test_mode_changes() call assert_equal(2, g:i_to_any) call assert_equal(3, g:nori_to_any) + if has('terminal') + let g:mode_seq += ['c', 'n', 't', 'nt', 'c', 'nt', 'n'] + call feedkeys(":term\\N:bd!\", 'tnix') + call assert_equal(len(g:mode_seq) - 1, g:index) + call assert_equal(1, g:n_to_i) + call assert_equal(1, g:n_to_niI) + call assert_equal(1, g:niI_to_i) + call assert_equal(2, g:nany_to_i) + call assert_equal(1, g:i_to_n) + call assert_equal(2, g:i_to_any) + call assert_equal(5, g:nori_to_any) + endif + au! ModeChanged delfunc TestMode unlet! g:mode_seq unlet! g:index - delfunc DoIt - unlet! g:count + unlet! g:n_to_any + unlet! g:V_to_v + unlet! g:n_to_i + unlet! g:n_to_niI + unlet! g:niI_to_i + unlet! g:nany_to_i + unlet! g:i_to_n + unlet! g:nori_to_any + unlet! g:i_to_any endfunc " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/version.c b/src/version.c index 16a290ba77..1c2231f145 100644 --- a/src/version.c +++ b/src/version.c @@ -757,6 +757,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 3555, /**/ 3554, /**/ From 841c225b9ef8c5bdf5e02968a0bd62521fff6ca8 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 22 Oct 2021 20:56:55 +0100 Subject: [PATCH 08/15] patch 8.2.3556: filler lines are incorrect for other window in diff mode Problem: Filler lines are incorrect for other window in diff mode after making a change. Solution: Copy filler lines from the current window. (closes #8809) --- src/diff.c | 22 ++++++++++++++----- .../dumps/Test_diff_scroll_change_03.dump | 20 +++++++++++++++++ src/testdir/test_diffmode.vim | 3 +++ src/version.c | 2 ++ 4 files changed, 41 insertions(+), 6 deletions(-) create mode 100644 src/testdir/dumps/Test_diff_scroll_change_03.dump diff --git a/src/diff.c b/src/diff.c index b59a125106..92a4d9f44e 100644 --- a/src/diff.c +++ b/src/diff.c @@ -656,7 +656,8 @@ diff_redraw( { win_T *wp; win_T *wp_other = NULL; - int used_max_fill = FALSE; + int used_max_fill_other = FALSE; + int used_max_fill_curwin = FALSE; int n; need_diff_redraw = FALSE; @@ -681,16 +682,25 @@ diff_redraw( { wp->w_topfill = n; if (wp == curwin) - used_max_fill = TRUE; + used_max_fill_curwin = TRUE; + else if (wp_other != NULL) + used_max_fill_other = TRUE; } check_topfill(wp, FALSE); } } - if (wp_other != NULL && used_max_fill && curwin->w_p_scb) - // The current window was set to used the maximum number of filler - // lines, may need to reduce them. - diff_set_topline(wp_other, curwin); + if (wp_other != NULL && curwin->w_p_scb) + { + if (used_max_fill_curwin) + // The current window was set to used the maximum number of filler + // lines, may need to reduce them. + diff_set_topline(wp_other, curwin); + else if (used_max_fill_other) + // The other window was set to used the maximum number of filler + // lines, may need to reduce them. + diff_set_topline(curwin, wp_other); + } } static void diff --git a/src/testdir/dumps/Test_diff_scroll_change_03.dump b/src/testdir/dumps/Test_diff_scroll_change_03.dump new file mode 100644 index 0000000000..6d0c8600f6 --- /dev/null +++ b/src/testdir/dumps/Test_diff_scroll_change_03.dump @@ -0,0 +1,20 @@ +| +0#0000e05#a8a8a8255@1|-+0#4040ff13#afffff255@34||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@1|6+0#0000000#5fd7ff255| @33 +| +0#0000e05#a8a8a8255@1|-+0#4040ff13#afffff255@34||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@1|7+0#0000000#5fd7ff255| @33 +| +0#0000e05#a8a8a8255@1|-+0#4040ff13#afffff255@34||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@1|8+0#0000000#5fd7ff255| @33 +| +0#0000e05#a8a8a8255@1|9+0#0000000#ffffff0| @33||+1&&| +0#0000e05#a8a8a8255@1|9+0#0000000#ffffff0| @33 +| +0#0000e05#a8a8a8255@1|1+0#0000000#ffffff0|0| @32||+1&&| +0#0000e05#a8a8a8255@1|1+0#0000000#ffffff0|0| @32 +| +0#0000e05#a8a8a8255@1|1+0#0000000#ffffff0@1| @32||+1&&| +0#0000e05#a8a8a8255@1|1+0#0000000#ffffff0@1| @32 +| +0#0000e05#a8a8a8255@1|1+0#0000000#ffffff0|2| @32||+1&&| +0#0000e05#a8a8a8255@1|1+0#0000000#ffffff0|2| @32 +| +0#0000e05#a8a8a8255@1|1+0#0000000#ffffff0|3| @32||+1&&| +0#0000e05#a8a8a8255@1|1+0#0000000#ffffff0|3| @32 +| +0#0000e05#a8a8a8255@1|1+0#0000000#ffffff0|4| @32||+1&&| +0#0000e05#a8a8a8255@1|1+0#0000000#ffffff0|4| @32 +| +0#0000e05#a8a8a8255@1|1+0#0000000#ffd7ff255|5|x+2&#ff404010| +0&#ffd7ff255@31||+1&#ffffff0| +0#0000e05#a8a8a8255@1|1+0#0000000#ffd7ff255|5>y+2&#ff404010| +0&#ffd7ff255@31 +|~+0#4040ff13#ffffff0| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|[+1#0000000&|N|o| |N|a|m|e|]| |[|+|]| @5|7|,|3| @11|A|l@1| |[+3&&|N|o| |N|a|m|e|]| |[|+|]| @5|1|5|,|3| @10|B|o|t +| +0&&@74 diff --git a/src/testdir/test_diffmode.vim b/src/testdir/test_diffmode.vim index 08ec71b918..e8bd0871b1 100644 --- a/src/testdir/test_diffmode.vim +++ b/src/testdir/test_diffmode.vim @@ -1013,6 +1013,9 @@ func Test_diff_with_scroll_and_change() call term_sendkeys(buf, "ax\") call VerifyScreenDump(buf, 'Test_diff_scroll_change_02', {}) + call term_sendkeys(buf, "\lay\") + call VerifyScreenDump(buf, 'Test_diff_scroll_change_03', {}) + " clean up call StopVimInTerminal(buf) call delete('Xtest_scroll_change') diff --git a/src/version.c b/src/version.c index 1c2231f145..362129eb26 100644 --- a/src/version.c +++ b/src/version.c @@ -757,6 +757,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 3556, /**/ 3555, /**/ From 5fe07d2e08f05c6f3905fecdf07f4cfad4d6ed17 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 22 Oct 2021 22:17:53 +0100 Subject: [PATCH 09/15] patch 8.2.3557: Vim9: cannot call imported funcref at script level Problem: Vim9: cannot call imported funcref at script level. Solution: Check for an imported function. (closes #9007) --- src/testdir/test_vim9_script.vim | 27 ++++++++++++++++ src/userfunc.c | 55 ++++++++++++++++++++++++++++---- src/version.c | 2 ++ 3 files changed, 77 insertions(+), 7 deletions(-) diff --git a/src/testdir/test_vim9_script.vim b/src/testdir/test_vim9_script.vim index b71978a3c5..ae58a0bfe5 100644 --- a/src/testdir/test_vim9_script.vim +++ b/src/testdir/test_vim9_script.vim @@ -1477,6 +1477,33 @@ def Test_vim9_import_export() delete('Xvim9_script') enddef +def Test_import_funcref() + var lines =<< trim END + vim9script + export def F(): number + return 42 + enddef + export const G = F + END + writefile(lines, 'Xlib.vim') + + lines =<< trim END + vim9script + import {G} from './Xlib.vim' + const Foo = G() + assert_equal(42, Foo) + + def DoTest() + const Goo = G() + assert_equal(42, Foo) + enddef + DoTest() + END + CheckScriptSuccess(lines) + + delete('Xlib.vim') +enddef + def Test_import_star_fails() writefile([], 'Xfoo.vim') var lines =<< trim END diff --git a/src/userfunc.c b/src/userfunc.c index ab441405c5..9784871128 100644 --- a/src/userfunc.c +++ b/src/userfunc.c @@ -1548,9 +1548,11 @@ deref_func_name( int no_autoload) { dictitem_T *v; + typval_T *tv = NULL; int cc; char_u *s = NULL; hashtab_T *ht; + int did_type = FALSE; if (partialp != NULL) *partialp = NULL; @@ -1562,20 +1564,59 @@ deref_func_name( name[*lenp] = cc; if (v != NULL) { - if (v->di_tv.v_type == VAR_FUNC) + tv = &v->di_tv; + } + else if (in_vim9script() || STRNCMP(name, "s:", 2) == 0) + { + imported_T *import; + char_u *p = name; + int len = *lenp; + + if (STRNCMP(name, "s:", 2) == 0) { - if (v->di_tv.vval.v_string == NULL) + p = name + 2; + len -= 2; + } + import = find_imported(p, len, NULL); + + // imported variable from another script + if (import != NULL) + { + if (import->imp_funcname != NULL) + { + s = import->imp_funcname; + *lenp = (int)STRLEN(s); + return s; + } + // TODO: what if (import->imp_flags & IMP_FLAGS_STAR) + { + scriptitem_T *si = SCRIPT_ITEM(import->imp_sid); + svar_T *sv = ((svar_T *)si->sn_var_vals.ga_data) + + import->imp_var_vals_idx; + tv = sv->sv_tv; + if (type != NULL) + *type = sv->sv_type; + did_type = TRUE; + } + } + } + + if (tv != NULL) + { + if (tv->v_type == VAR_FUNC) + { + if (tv->vval.v_string == NULL) { *lenp = 0; return (char_u *)""; // just in case } - s = v->di_tv.vval.v_string; + s = tv->vval.v_string; *lenp = (int)STRLEN(s); } - if (v->di_tv.v_type == VAR_PARTIAL) + if (tv->v_type == VAR_PARTIAL) { - partial_T *pt = v->di_tv.vval.v_partial; + partial_T *pt = tv->vval.v_partial; if (pt == NULL) { @@ -1590,9 +1631,9 @@ deref_func_name( if (s != NULL) { - if (type != NULL && ht == get_script_local_ht()) + if (!did_type && type != NULL && ht == get_script_local_ht()) { - svar_T *sv = find_typval_in_script(&v->di_tv); + svar_T *sv = find_typval_in_script(tv); if (sv != NULL) *type = sv->sv_type; diff --git a/src/version.c b/src/version.c index 362129eb26..ea396cd578 100644 --- a/src/version.c +++ b/src/version.c @@ -757,6 +757,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 3557, /**/ 3556, /**/ From 06ca48a40f049f20347c9630a180457d1f1aece5 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 23 Oct 2021 10:25:21 +0100 Subject: [PATCH 10/15] patch 8.2.3558: Vim9: asserting the wrong variable Problem: Vim9: asserting the wrong variable. Solution: Don't use Foo, use Goo. --- src/testdir/test_vim9_script.vim | 2 +- src/version.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/testdir/test_vim9_script.vim b/src/testdir/test_vim9_script.vim index ae58a0bfe5..7e174dfb2c 100644 --- a/src/testdir/test_vim9_script.vim +++ b/src/testdir/test_vim9_script.vim @@ -1495,7 +1495,7 @@ def Test_import_funcref() def DoTest() const Goo = G() - assert_equal(42, Foo) + assert_equal(42, Goo) enddef DoTest() END diff --git a/src/version.c b/src/version.c index ea396cd578..53ceef0bf6 100644 --- a/src/version.c +++ b/src/version.c @@ -757,6 +757,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 3558, /**/ 3557, /**/ From 079ba76ae7a7d0ef404cb9b41dff2663ff41f51b Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 23 Oct 2021 12:08:41 +0100 Subject: [PATCH 11/15] Update runtime files --- .github/CODEOWNERS | 1 + runtime/doc/eval.txt | 2 +- runtime/doc/insert.txt | 4 +- runtime/doc/map.txt | 5 +- runtime/doc/options.txt | 5 +- runtime/doc/quickref.txt | 3 +- runtime/doc/tags | 8 + runtime/doc/todo.txt | 4 +- runtime/ftplugin/changelog.vim | 26 +- runtime/ftplugin/nsis.vim | 4 +- runtime/indent/dosbatch.vim | 4 +- runtime/indent/nsis.vim | 4 +- runtime/indent/teraterm.vim | 4 +- runtime/optwin.vim | 7 +- runtime/syntax/arduino.vim | 87 +++-- runtime/syntax/debchangelog.vim | 5 +- runtime/syntax/debsources.vim | 5 +- runtime/syntax/nsis.vim | 42 ++- src/po/it.po | 568 ++++++++++++++++++++------------ 19 files changed, 514 insertions(+), 274 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 0bfb1a9937..5a19fb97bd 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -169,6 +169,7 @@ runtime/plugin/vimballPlugin.vim @cecamp runtime/plugin/zipPlugin.vim @cecamp runtime/syntax/aidl.vim @dpelle runtime/syntax/amiga.vim @cecamp +runtime/syntax/arduino.vim @johshoff runtime/syntax/asm.vim @dkearns runtime/syntax/asmh8300.vim @dkearns runtime/syntax/asterisk.vim @jaunis diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index c009494318..8d31483ec6 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1,4 +1,4 @@ -*eval.txt* For Vim version 8.2. Last change: 2021 Oct 14 +*eval.txt* For Vim version 8.2. Last change: 2021 Oct 20 VIM REFERENCE MANUAL by Bram Moolenaar diff --git a/runtime/doc/insert.txt b/runtime/doc/insert.txt index 7788c0b717..7d218930d9 100644 --- a/runtime/doc/insert.txt +++ b/runtime/doc/insert.txt @@ -1,4 +1,4 @@ -*insert.txt* For Vim version 8.2. Last change: 2021 Aug 31 +*insert.txt* For Vim version 8.2. Last change: 2021 Oct 18 VIM REFERENCE MANUAL by Bram Moolenaar @@ -893,7 +893,7 @@ Groß): > endif endfunc - if has('patch-8.2.3520') + if exists('+thesaurusfunc') set thesaurusfunc=Thesaur endif diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt index 8da3a78afa..2c77355714 100644 --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -1,4 +1,4 @@ -*map.txt* For Vim version 8.2. Last change: 2021 Sep 12 +*map.txt* For Vim version 8.2. Last change: 2021 Oct 19 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1004,6 +1004,9 @@ Also note that the 'clipboard' option is temporarily emptied to avoid clobbering the `"*` or `"+` registers, if its value contains the item `unnamed` or `unnamedplus`. +The `mode()` function will return the state as it will be after applying the +operator. + ============================================================================== 2. Abbreviations *abbreviations* *Abbreviations* diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index f884448bf2..f210d31e98 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -1,4 +1,4 @@ -*options.txt* For Vim version 8.2. Last change: 2021 Sep 21 +*options.txt* For Vim version 8.2. Last change: 2021 Oct 20 VIM REFERENCE MANUAL by Bram Moolenaar @@ -717,7 +717,8 @@ A jump table for the options with a short description can be found at |Q_op|. "double": Use twice the width of ASCII characters. *E834* *E835* The value "double" cannot be used if 'listchars' or 'fillchars' - contains a character that would be double width. + contains a character that would be double width. These errors may + also be given when calling setcellwidths(). The values are overruled for characters specified with |setcellwidths()|. diff --git a/runtime/doc/quickref.txt b/runtime/doc/quickref.txt index f7c5c1789e..f1e2ac4221 100644 --- a/runtime/doc/quickref.txt +++ b/runtime/doc/quickref.txt @@ -1,4 +1,4 @@ -*quickref.txt* For Vim version 8.2. Last change: 2021 Mar 29 +*quickref.txt* For Vim version 8.2. Last change: 2021 Oct 17 VIM REFERENCE MANUAL by Bram Moolenaar @@ -732,6 +732,7 @@ Short explanation of each option: *option-list* 'guifontset' 'gfs' GUI: Names of multibyte fonts to be used 'guifontwide' 'gfw' list of font names for double-wide characters 'guiheadroom' 'ghr' GUI: pixels room for window decorations +'guiligatures' 'gli' GTK GUI: ASCII characters that can form shapes 'guioptions' 'go' GUI: Which components and options are used 'guipty' GUI: try to use a pseudo-tty for ":!" commands 'guitablabel' 'gtl' GUI: custom label for a tab page diff --git a/runtime/doc/tags b/runtime/doc/tags index 81df62d31e..e522fe82bc 100644 --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -302,6 +302,7 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX* 'gfs' options.txt /*'gfs'* 'gfw' options.txt /*'gfw'* 'ghr' options.txt /*'ghr'* +'gli' options.txt /*'gli'* 'go' options.txt /*'go'* 'go-!' options.txt /*'go-!'* 'go-A' options.txt /*'go-A'* @@ -339,6 +340,7 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX* 'guifontset' options.txt /*'guifontset'* 'guifontwide' options.txt /*'guifontwide'* 'guiheadroom' options.txt /*'guiheadroom'* +'guiligatures' options.txt /*'guiligatures'* 'guioptions' options.txt /*'guioptions'* 'guipty' options.txt /*'guipty'* 'guitablabel' options.txt /*'guitablabel'* @@ -1138,6 +1140,7 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX* 'tgc' options.txt /*'tgc'* 'tgst' options.txt /*'tgst'* 'thesaurus' options.txt /*'thesaurus'* +'thesaurusfunc' options.txt /*'thesaurusfunc'* 'tildeop' options.txt /*'tildeop'* 'timeout' options.txt /*'timeout'* 'timeoutlen' options.txt /*'timeoutlen'* @@ -2077,6 +2080,7 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX* :XMLent insert.txt /*:XMLent* :XMLns insert.txt /*:XMLns* :[range] motion.txt /*:[range]* +:[vV\x16] autocmd.txt /*:[vV\\x16]* :\bar cmdline.txt /*:\\bar* :_! cmdline.txt /*:_!* :_# cmdline.txt /*:_#* @@ -3992,6 +3996,7 @@ E1233 eval.txt /*E1233* E1237 map.txt /*E1237* E1239 eval.txt /*E1239* E124 eval.txt /*E124* +E1243 options.txt /*E1243* E125 eval.txt /*E125* E126 eval.txt /*E126* E127 eval.txt /*E127* @@ -5930,6 +5935,8 @@ compl-omni-filetypes insert.txt /*compl-omni-filetypes* compl-spelling insert.txt /*compl-spelling* compl-stop insert.txt /*compl-stop* compl-tag insert.txt /*compl-tag* +compl-thesaurus insert.txt /*compl-thesaurus* +compl-thesaurusfunc insert.txt /*compl-thesaurusfunc* compl-vim insert.txt /*compl-vim* compl-whole-line insert.txt /*compl-whole-line* complete() eval.txt /*complete()* @@ -9826,6 +9833,7 @@ try-echoerr eval.txt /*try-echoerr* try-finally eval.txt /*try-finally* try-nested eval.txt /*try-nested* try-nesting eval.txt /*try-nesting* +tsrfu' options.txt /*tsrfu'* tutor usr_01.txt /*tutor* twice if_cscop.txt /*twice* two-engines pattern.txt /*two-engines* diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt index 558493b53e..80310f2399 100644 --- a/runtime/doc/todo.txt +++ b/runtime/doc/todo.txt @@ -1,4 +1,4 @@ -*todo.txt* For Vim version 8.2. Last change: 2021 Oct 15 +*todo.txt* For Vim version 8.2. Last change: 2021 Oct 16 VIM REFERENCE MANUAL by Bram Moolenaar @@ -38,8 +38,6 @@ browser use: https://github.com/vim/vim/issues/1234 *known-bugs* -------------------- Known bugs and current work ----------------------- -Remove s:flaky_tests from runtest.vim, set g:test_is_flaky in each test. - Vim9 - Make everything work: - "filter #pat# ls" should work, #pat# is not a comment vim9script diff --git a/runtime/ftplugin/changelog.vim b/runtime/ftplugin/changelog.vim index 257e9cd9d4..e9df63f8c9 100644 --- a/runtime/ftplugin/changelog.vim +++ b/runtime/ftplugin/changelog.vim @@ -2,7 +2,7 @@ " Language: generic Changelog file " Maintainer: Martin Florian " Previous Maintainer: Nikolai Weibull -" Latest Revision: 2015-10-25 +" Latest Revision: 2021-10-17 " Variables: " g:changelog_timeformat (deprecated: use g:changelog_dateformat instead) - " description: the timeformat used in ChangeLog entries. @@ -55,7 +55,7 @@ if &filetype == 'changelog' elseif $EMAIL_ADDRESS != "" return $EMAIL_ADDRESS endif - + let login = s:login() return printf('%s <%s@%s>', s:name(login), login, s:hostname()) endfunction @@ -223,12 +223,6 @@ if &filetype == 'changelog' let &paste = save_paste endfunction - if exists(":NewChangelogEntry") != 2 - nnoremap o :call new_changelog_entry('') - xnoremap o :call new_changelog_entry('') - command! -nargs=0 NewChangelogEntry call s:new_changelog_entry('') - endif - let b:undo_ftplugin = "setl com< fo< et< ai<" setlocal comments= @@ -241,14 +235,26 @@ if &filetype == 'changelog' let b:undo_ftplugin .= " tw<" endif + if !exists("no_plugin_maps") && !exists("no_changelog_maps") && exists(":NewChangelogEntry") != 2 + nnoremap o :call new_changelog_entry('') + xnoremap o :call new_changelog_entry('') + command! -buffer -nargs=0 NewChangelogEntry call s:new_changelog_entry('') + let b:undo_ftplugin .= " | sil! exe 'nunmap o'" . + \ " | sil! exe 'vunmap o'" . + \ " | sil! delc NewChangelogEntry" + endif + let &cpo = s:cpo_save unlet s:cpo_save else let s:cpo_save = &cpo set cpo&vim - " Add the Changelog opening mapping - nnoremap o :call open_changelog() + if !exists("no_plugin_maps") && !exists("no_changelog_maps") + " Add the Changelog opening mapping + nnoremap o :call open_changelog() + let b:undo_ftplugin .= " | silent! exe 'nunmap o" + endif function! s:open_changelog() let path = expand('%:p:h') diff --git a/runtime/ftplugin/nsis.vim b/runtime/ftplugin/nsis.vim index 1a35127c86..3dc0d6318a 100644 --- a/runtime/ftplugin/nsis.vim +++ b/runtime/ftplugin/nsis.vim @@ -3,7 +3,7 @@ " Maintainer: Ken Takata " URL: https://github.com/k-takata/vim-nsis " Previous Maintainer: Nikolai Weibull -" Last Change: 2018-01-26 +" Last Change: 2021-10-18 if exists("b:did_ftplugin") finish @@ -15,7 +15,6 @@ set cpo&vim let b:did_ftplugin = 1 let b:undo_ftplugin = "setl com< cms< fo< def< inc<" - \ " | unlet! b:match_ignorecase b:match_words" setlocal comments=s1:/*,mb:*,ex:*/,b:#,:; commentstring=;\ %s setlocal formatoptions-=t formatoptions+=croql @@ -37,6 +36,7 @@ if exists("loaded_matchit") \ '\${MementoSection}:\${MementoSectionEnd},' . \ '!if\%(\%(macro\)\?n\?def\)\?\>:!else\>:!endif\>,' . \ '!macro\>:!macroend\>' + let b:undo_ftplugin .= " | unlet! b:match_ignorecase b:match_words" endif let &cpo = s:cpo_save diff --git a/runtime/indent/dosbatch.vim b/runtime/indent/dosbatch.vim index aea2a184d4..d24b139242 100644 --- a/runtime/indent/dosbatch.vim +++ b/runtime/indent/dosbatch.vim @@ -2,7 +2,7 @@ " Language: MSDOS batch file (with NT command extensions) " Maintainer: Ken Takata " URL: https://github.com/k-takata/vim-dosbatch-indent -" Last Change: 2017 May 10 +" Last Change: 2021-10-18 " Filenames: *.bat " License: VIM License @@ -17,6 +17,8 @@ setlocal indentexpr=GetDosBatchIndent(v:lnum) setlocal indentkeys=!^F,o,O setlocal indentkeys+=0=) +let b:undo_indent = "setl ai< inde< indk< si<" + if exists("*GetDosBatchIndent") finish endif diff --git a/runtime/indent/nsis.vim b/runtime/indent/nsis.vim index 223f4fa28e..5d3decca37 100644 --- a/runtime/indent/nsis.vim +++ b/runtime/indent/nsis.vim @@ -2,7 +2,7 @@ " Language: NSIS script " Maintainer: Ken Takata " URL: https://github.com/k-takata/vim-nsis -" Last Change: 2018-01-21 +" Last Change: 2021-10-18 " Filenames: *.nsi " License: VIM License @@ -17,6 +17,8 @@ setlocal indentexpr=GetNsisIndent(v:lnum) setlocal indentkeys=!^F,o,O setlocal indentkeys+==~${Else,=~${EndIf,=~${EndUnless,=~${AndIf,=~${AndUnless,=~${OrIf,=~${OrUnless,=~${Case,=~${Default,=~${EndSelect,=~${EndSwith,=~${Loop,=~${Next,=~${MementoSectionEnd,=~FunctionEnd,=~SectionEnd,=~SectionGroupEnd,=~PageExEnd,0=~!macroend,0=~!if,0=~!else,0=~!endif +let b:undo_indent = "setl ai< inde< indk< si<" + if exists("*GetNsisIndent") finish endif diff --git a/runtime/indent/teraterm.vim b/runtime/indent/teraterm.vim index 35d7354290..181c9a343f 100644 --- a/runtime/indent/teraterm.vim +++ b/runtime/indent/teraterm.vim @@ -3,7 +3,7 @@ " Based on Tera Term Version 4.100 " Maintainer: Ken Takata " URL: https://github.com/k-takata/vim-teraterm -" Last Change: 2018-08-31 +" Last Change: 2021-10-18 " Filenames: *.ttl " License: VIM License @@ -18,6 +18,8 @@ setlocal indentexpr=GetTeraTermIndent(v:lnum) setlocal indentkeys=!^F,o,O,e setlocal indentkeys+==elseif,=endif,=loop,=next,=enduntil,=endwhile +let b:undo_indent = "setl ai< inde< indk< si<" + if exists("*GetTeraTermIndent") finish endif diff --git a/runtime/optwin.vim b/runtime/optwin.vim index 176f9eafc8..5d178809d1 100644 --- a/runtime/optwin.vim +++ b/runtime/optwin.vim @@ -1,7 +1,7 @@ " These commands create the option window. " " Maintainer: Bram Moolenaar -" Last Change: 2020 Oct 27 +" Last Change: 2021 Oct 17 " If there already is an option window, jump to that one. let buf = bufnr('option-window') @@ -652,6 +652,8 @@ if has("gui") endif call AddOption("guiheadroom", gettext("room (in pixels) left above/below the window")) call append("$", " \tset ghr=" . &ghr) + call AddOption("guiligatures", gettext("list of ASCII characters that can be combined into complesshapes")) + call OptionG("gli", &gli) endif if has("directx") call AddOption("renderoptions", gettext("options for text rendering")) @@ -840,6 +842,9 @@ if has("insert_expand") call AddOption("thesaurus", gettext("list of thesaurus files for keyword completion")) call append("$", "\t" .. s:global_or_local) call OptionG("tsr", &tsr) + call AddOption("thesaurusfunc", gettext("function used for thesaurus completion")) + call append("$", "\t" .. s:global_or_local) + call OptionG("tsrfu", &tsrfu) endif call AddOption("infercase", gettext("adjust case of a keyword completion match")) call append("$", "\t" .. s:local_to_buffer) diff --git a/runtime/syntax/arduino.vim b/runtime/syntax/arduino.vim index 4a4ef82072..1c9618ff0f 100644 --- a/runtime/syntax/arduino.vim +++ b/runtime/syntax/arduino.vim @@ -1,50 +1,79 @@ " Vim syntax file " Language: Arduino " Maintainer: Johannes Hoff -" Last Change: 2011 June 3 +" Last Change: 21 October 2021 " License: VIM license (:help license, replace vim by arduino.vim) " Syntax highlighting like in the Arduino IDE -" Keywords extracted from /build/shared/lib/keywords.txt (arduino -" version 0021) +" Automatically generated by the script available at +" https://bitbucket.org/johannes/arduino-vim-syntax +" Using keywords from /build/shared/lib/keywords.txt +" From version: 1.8.16 -" Thanks to Rik, Erik Nomitch, Adam Obeng and Graeme Cross for helpful feedback! +" Thanks to Rik, Erik Nomitch, Adam Obeng, Graeme Cross and Niall Parker +" for helpful feedback! -" quit when a syntax file was already loaded -if exists("b:current_syntax") +" For version 5.x: Clear all syntax items +" For version 6.x: Quit when a syntax file was already loaded +if version < 600 + syntax clear +elseif exists("b:current_syntax") finish endif " Read the C syntax to start with -runtime! syntax/cpp.vim +if version < 600 + so :p:h/cpp.vim +else + runtime! syntax/cpp.vim +endif -syn keyword arduinoConstant HIGH LOW INPUT OUTPUT -syn keyword arduinoConstant DEC BIN HEX OCT BYTE -syn keyword arduinoConstant PI HALF_PI TWO_PI -syn keyword arduinoConstant LSBFIRST MSBFIRST -syn keyword arduinoConstant CHANGE FALLING RISING -syn keyword arduinoConstant SERIAL DISPLAY -syn keyword arduinoConstant DEFAULT EXTERNAL INTERNAL INTERNAL1V1 INTERNAL2V56 +syn keyword arduinoConstant BIN CHANGE DEC DEFAULT EXTERNAL FALLING HALF_PI HEX +syn keyword arduinoConstant HIGH INPUT INPUT_PULLUP INTERNAL INTERNAL1V1 +syn keyword arduinoConstant INTERNAL2V56 LED_BUILTIN LED_BUILTIN_RX +syn keyword arduinoConstant LED_BUILTIN_TX LOW LSBFIRST MSBFIRST OCT OUTPUT PI +syn keyword arduinoConstant RISING TWO_PI -syn keyword arduinoStdFunc abs acos asin atan atan2 ceil constrain -syn keyword arduinoStdFunc cos degrees exp floor log -syn keyword arduinoStdFunc map max min pow radians -syn keyword arduinoStdFunc round sin sq sqrt tan -syn keyword arduinoStdFunc randomSeed random +syn keyword arduinoFunc analogRead analogReadResolution analogReference +syn keyword arduinoFunc analogWrite analogWriteResolution attachInterrupt +syn keyword arduinoFunc bit bitClear bitRead bitSet bitWrite delay +syn keyword arduinoFunc delayMicroseconds detachInterrupt +syn keyword arduinoFunc digitalPinToInterrupt digitalRead digitalWrite +syn keyword arduinoFunc highByte interrupts lowByte micros millis +syn keyword arduinoFunc noInterrupts noTone pinMode pulseIn pulseInLong +syn keyword arduinoFunc shiftIn shiftOut tone yield -syn keyword arduinoFunc analogReference analogRead analogWrite -syn keyword arduinoFunc attachInterrupt detachInterrupt interrupts noInterrupts -syn keyword arduinoFunc lowByte highByte bitRead bitWrite bitSet bitClear -syn keyword arduinoFunc millis micros delay delayMicroseconds -syn keyword arduinoFunc pinMode digitalWrite digitalRead -syn keyword arduinoFunc tone noTone pulseIn shiftOut +syn keyword arduinoMethod available availableForWrite begin charAt compareTo +syn keyword arduinoMethod concat end endsWith equals equalsIgnoreCase export +syn keyword arduinoMethod final find findUntil flush getBytes indexOf +syn keyword arduinoMethod lastIndexOf length loop override parseFloat +syn keyword arduinoMethod parseInt peek print println read readBytes +syn keyword arduinoMethod readBytesUntil readString readStringUntil replace +syn keyword arduinoMethod setCharAt setTimeout setup startsWith Stream +syn keyword arduinoMethod substring toCharArray toInt toLowerCase toUpperCase +syn keyword arduinoMethod trim -syn keyword arduinoMethod setup loop -syn keyword arduinoMethod begin end available read flush print println write peek +syn keyword arduinoModule Keyboard Mouse Serial Serial1 Serial2 Serial3 +syn keyword arduinoModule SerialUSB -syn keyword arduinoType boolean byte word String +syn keyword arduinoStdFunc abs accept acos acosf asin asinf atan atan2 atan2f +syn keyword arduinoStdFunc atanf cbrt cbrtf ceil ceilf click constrain +syn keyword arduinoStdFunc copysign copysignf cos cosf cosh coshf degrees exp +syn keyword arduinoStdFunc expf fabs fabsf fdim fdimf floor floorf fma fmaf +syn keyword arduinoStdFunc fmax fmaxf fmin fminf fmod fmodf hypot hypotf +syn keyword arduinoStdFunc isfinite isinf isnan isPressed ldexp ldexpf log +syn keyword arduinoStdFunc log10 log10f logf lrint lrintf lround lroundf map +syn keyword arduinoStdFunc max min move pow powf press radians random +syn keyword arduinoStdFunc randomSeed release releaseAll round roundf signbit +syn keyword arduinoStdFunc sin sinf sinh sinhf sq sqrt sqrtf tan tanf tanh +syn keyword arduinoStdFunc tanhf trunc truncf -syn keyword arduinoModule Serial Serial1 Serial2 Serial3 +syn keyword arduinoType _Bool _Complex _Imaginary array atomic_bool +syn keyword arduinoType atomic_char atomic_int atomic_llong atomic_long +syn keyword arduinoType atomic_schar atomic_short atomic_uchar atomic_uint +syn keyword arduinoType atomic_ullong atomic_ulong atomic_ushort boolean +syn keyword arduinoType byte char16_t char32_t complex NULL null PROGMEM +syn keyword arduinoType String word hi def link arduinoType Type hi def link arduinoConstant Constant diff --git a/runtime/syntax/debchangelog.vim b/runtime/syntax/debchangelog.vim index 93b03ae06d..79352c0827 100644 --- a/runtime/syntax/debchangelog.vim +++ b/runtime/syntax/debchangelog.vim @@ -3,7 +3,7 @@ " Maintainer: Debian Vim Maintainers " Former Maintainers: Gerfried Fuchs " Wichert Akkerman -" Last Change: 2021 Aug 03 +" Last Change: 2021 Oct 19 " URL: https://salsa.debian.org/vim-team/vim-debian/blob/master/syntax/debchangelog.vim " Standard syntax initialization @@ -24,7 +24,8 @@ let s:supported = [ \ 'jessie', 'stretch', 'buster', 'bullseye', 'bookworm', \ 'trixie', 'sid', 'rc-buggy', \ - \ 'trusty', 'xenial', 'bionic', 'focal', 'hirsute', 'impish', 'devel' + \ 'trusty', 'xenial', 'bionic', 'focal', 'hirsute', 'impish', 'jammy', + \ 'devel' \ ] let s:unsupported = [ \ 'frozen', 'buzz', 'rex', 'bo', 'hamm', 'slink', 'potato', diff --git a/runtime/syntax/debsources.vim b/runtime/syntax/debsources.vim index 8aa96fcb58..4b4c497f18 100644 --- a/runtime/syntax/debsources.vim +++ b/runtime/syntax/debsources.vim @@ -2,7 +2,7 @@ " Language: Debian sources.list " Maintainer: Debian Vim Maintainers " Former Maintainer: Matthijs Mohlmann -" Last Change: 2021 Aug 03 +" Last Change: 2021 Oct 19 " URL: https://salsa.debian.org/vim-team/vim-debian/blob/master/syntax/debsources.vim " Standard syntax initialization @@ -26,7 +26,8 @@ let s:supported = [ \ 'jessie', 'stretch', 'buster', 'bullseye', 'bookworm', \ 'trixie', 'sid', 'rc-buggy', \ - \ 'trusty', 'xenial', 'bionic', 'focal', 'hirsute', 'impish', 'devel' + \ 'trusty', 'xenial', 'bionic', 'focal', 'hirsute', 'impish', 'jammy', + \ 'devel' \ ] let s:unsupported = [ \ 'buzz', 'rex', 'bo', 'hamm', 'slink', 'potato', diff --git a/runtime/syntax/nsis.vim b/runtime/syntax/nsis.vim index 3389771b78..3a73fe0989 100644 --- a/runtime/syntax/nsis.vim +++ b/runtime/syntax/nsis.vim @@ -1,9 +1,9 @@ " Vim syntax file -" Language: NSIS script, for version of NSIS 3.03 and later +" Language: NSIS script, for version of NSIS 3.08 and later " Maintainer: Ken Takata " URL: https://github.com/k-takata/vim-nsis " Previous Maintainer: Alex Jakushev -" Last Change: 2018-10-02 +" Last Change: 2020-10-18 " quit when a syntax file was already loaded if exists("b:current_syntax") @@ -97,6 +97,8 @@ syn match nsisSysVar "$RESOURCES_LOCALIZED" syn match nsisSysVar "$CDBURN_AREA" syn match nsisSysVar "$HWNDPARENT" syn match nsisSysVar "$PLUGINSDIR" +syn match nsisSysVar "$\%(USERTEMPLATES\|USERSTARTMENU\|USERSMPROGRAMS\|USERDESKTOP\)" +syn match nsisSysVar "$\%(COMMONTEMPLATES\|COMMONSTARTMENU\|COMMONSMPROGRAMS\|COMMONDESKTOP\|COMMONPROGRAMDATA\)" syn match nsisSysVar "$\\r" syn match nsisSysVar "$\\n" syn match nsisSysVar "$\\t" @@ -149,7 +151,7 @@ syn keyword nsisStatement contained Section nextgroup=nsisSectionOpt skipwhite syn region nsisSectionOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisSectionKwd syn match nsisSectionKwd contained "/o\>" -syn keyword nsisStatement contained SectionIn nextgroup=nsisSectionInOpt skipwhite +syn keyword nsisStatement contained SectionInstType SectionIn nextgroup=nsisSectionInOpt skipwhite syn region nsisSectionInOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisSectionInKwd syn keyword nsisSectionInKwd contained RO @@ -269,10 +271,22 @@ syn keyword nsisAttribute contained ManifestDPIAware nextgroup=nsisManifestDPIAw syn region nsisManifestDPIAwareOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisManifestDPIAwareKwd syn keyword nsisManifestDPIAwareKwd contained notset true false +syn keyword nsisAttribute contained ManifestLongPathAware nextgroup=nsisManifestLongPathAwareOpt skipwhite +syn region nsisManifestLongPathAwareOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisManifestLongPathAwareKwd +syn match nsisManifestLongPathAwareKwd contained "\<\%(notset\|true\|false\)\>" + syn keyword nsisAttribute contained ManifestSupportedOS nextgroup=nsisManifestSupportedOSOpt skipwhite syn region nsisManifestSupportedOSOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisManifestSupportedOSKwd syn match nsisManifestSupportedOSKwd contained "\<\%(none\|all\|WinVista\|Win7\|Win8\|Win8\.1\|Win10\)\>" +syn keyword nsisAttribute contained PEAddResource nextgroup=nsisPEAddResourceOpt skipwhite +syn region nsisPEAddResourceOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisPEAddResourceKwd +syn match nsisPEAddResourceKwd contained "/\%(OVERWRITE\|REPLACE\)\>" + +syn keyword nsisAttribute contained PERemoveResource nextgroup=nsisPERemoveResourceOpt skipwhite +syn region nsisPERemoveResourceOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisPERemoveResourceKwd +syn match nsisPERemoveResourceKwd contained "/NOERRORS\>" + syn keyword nsisAttribute contained RequestExecutionLevel nextgroup=nsisRequestExecutionLevelOpt skipwhite syn region nsisRequestExecutionLevelOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisRequestExecutionLevelKwd syn keyword nsisRequestExecutionLevelKwd contained none user highest admin @@ -353,7 +367,7 @@ syn keyword nsisInstruction contained ExpandEnvStrings ReadEnvStr syn keyword nsisInstruction contained DeleteRegKey nextgroup=nsisDeleteRegKeyOpt skipwhite syn region nsisDeleteRegKeyOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisDeleteRegKeyKwd,nsisRegistry -syn match nsisDeleteRegKeyKwd contained "/ifempty\>" +syn match nsisDeleteRegKeyKwd contained "/\%(ifempty\|ifnosubkeys\|ifnovalues\)\>" syn keyword nsisInstruction contained nextgroup=nsisRegistryOpt skipwhite \ DeleteRegValue EnumRegKey EnumRegValue ReadRegDWORD ReadRegStr WriteRegBin WriteRegDWORD WriteRegExpandStr WriteRegStr @@ -368,8 +382,8 @@ syn region nsisSetRegViewOpt contained start="" end="$" transparent keepend cont syn keyword nsisSetRegViewKwd contained default lastused "FUNCTIONS - general purpose (4.9.3) -syn keyword nsisInstruction contained CallInstDLL CreateDirectory GetDLLVersion -syn keyword nsisInstruction contained GetDLLVersionLocal GetFileTime GetFileTimeLocal +syn keyword nsisInstruction contained CallInstDLL CreateDirectory GetWinVer +syn keyword nsisInstruction contained GetFileTime GetFileTimeLocal GetKnownFolderPath syn keyword nsisInstruction contained GetTempFileName SearchPath RegDLL UnRegDLL syn keyword nsisInstruction contained CopyFiles nextgroup=nsisCopyFilesOpt skipwhite @@ -380,6 +394,10 @@ syn keyword nsisInstruction contained CreateShortcut nextgroup=nsisCreateShortcu syn region nsisCreateShortcutOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisCreateShortcutKwd syn match nsisCreateShortcutKwd contained "/NoWorkingDir\>" +syn keyword nsisInstruction contained GetDLLVersion GetDLLVersionLocal nextgroup=nsisGetDLLVersionOpt skipwhite +syn region nsisGetDLLVersionOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisGetDLLVersionKwd +syn match nsisGetDLLVersionKwd contained "/ProductVersion\>" + syn keyword nsisInstruction contained GetFullPathName nextgroup=nsisGetFullPathNameOpt skipwhite syn region nsisGetFullPathNameOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisGetFullPathNameKwd syn match nsisGetFullPathNameKwd contained "/SHORT\>" @@ -395,6 +413,7 @@ syn keyword nsisFileAttrib contained FILE_ATTRIBUTE_TEMPORARY syn keyword nsisInstruction contained Abort Call ClearErrors GetCurrentAddress syn keyword nsisInstruction contained GetFunctionAddress GetLabelAddress Goto syn keyword nsisInstruction contained IfAbort IfErrors IfFileExists IfRebootFlag IfSilent +syn keyword nsisInstruction contained IfShellVarContextAll IfRtlLanguage syn keyword nsisInstruction contained IntCmp IntCmpU Int64Cmp Int64CmpU IntPtrCmp IntPtrCmpU syn keyword nsisInstruction contained Return Quit SetErrors StrCmp StrCmpS @@ -460,6 +479,10 @@ syn keyword nsisInstruction contained CreateFont nextgroup=nsisFontOpt skipwhite syn keyword nsisInstruction contained nextgroup=nsisBooleanOpt skipwhite \ LockWindow SetAutoClose +syn keyword nsisInstruction contained LoadAndSetImage nextgroup=nsisLoadAndSetImageOpt skipwhite +syn region nsisLoadAndSetImageOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisLoadAndSetImageKwd +syn match nsisLoadAndSetImageKwd contained "/\%(EXERESOURCE\|STRINGID\|RESIZETOFIT\%(WIDTH\|HEIGHT\)\)\>" + syn keyword nsisInstruction contained SendMessage nextgroup=nsisSendMessageOpt skipwhite syn region nsisSendMessageOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisSendMessageKwd syn match nsisSendMessageKwd contained "/TIMEOUT\>" @@ -556,7 +579,7 @@ syn keyword nsisVerboseKwd contained push pop "PREPROCESSOR (5.4) syn match nsisDefine contained "!define\>" nextgroup=nsisDefineOpt skipwhite syn region nsisDefineOpt contained start="" end="$" transparent keepend contains=@nsisAnyOpt,nsisDefineKwd -syn match nsisDefineKwd contained "/\%(ifndef\|redef\|date\|utcdate\|math\|file\)\>" +syn match nsisDefineKwd contained "/\%(ifndef\|redef\|date\|utcdate\|file\|intfmt\|math\)\>" syn match nsisDefine contained "!undef\>" syn match nsisPreCondit contained "!ifdef\>" @@ -615,7 +638,10 @@ hi def link nsisInstTypeKwd Constant hi def link nsisLicenseBkColorKwd Constant hi def link nsisLicenseForceSelectionKwd Constant hi def link nsisManifestDPIAwareKwd Constant +hi def link nsisManifestLongPathAwareKwd Constant hi def link nsisManifestSupportedOSKwd Constant +hi def link nsisPEAddResourceKwd Constant +hi def link nsisPERemoveResourceKwd Constant hi def link nsisRequestExecutionLevelKwd Constant hi def link nsisShowInstDetailsKwd Constant hi def link nsisSilentInstallKwd Constant @@ -633,11 +659,13 @@ hi def link nsisWriteRegMultiStrKwd Constant hi def link nsisSetRegViewKwd Constant hi def link nsisCopyFilesKwd Constant hi def link nsisCreateShortcutKwd Constant +hi def link nsisGetDLLVersionKwd Constant hi def link nsisGetFullPathNameKwd Constant hi def link nsisFileAttrib Constant hi def link nsisMessageBox Constant hi def link nsisFileWriteUTF16LEKwd Constant hi def link nsisSetShellVarContextKwd Constant +hi def link nsisLoadAndSetImageKwd Constant hi def link nsisSendMessageKwd Constant hi def link nsisSetBrandingImageKwd Constant hi def link nsisSetDetailsViewKwd Constant diff --git a/src/po/it.po b/src/po/it.po index 3a5bfc9e51..02022cd31c 100644 --- a/src/po/it.po +++ b/src/po/it.po @@ -15,8 +15,8 @@ msgid "" msgstr "" "Project-Id-Version: vim 8.2\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-06-29 20:40+0200\n" -"PO-Revision-Date: 2021-06-14 23:10+0100\n" +"POT-Creation-Date: 2021-10-22 14:41+0200\n" +"PO-Revision-Date: 2021-10-22 17:00+0100\n" "Last-Translator: Antonio Colombo \n" "Language-Team: Italian\n" "Language: it\n" @@ -25,6 +25,29 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" +msgid "ERROR: " +msgstr "ERRORE: " + +msgid "" +"\n" +"[bytes] total alloc-freed %lu-%lu, in use %lu, peak use %lu\n" +msgstr "" +"\n" +"[byte] totali alloc-rilasc %lu-%lu, in uso %lu, max uso %lu\n" + +msgid "" +"[calls] total re/malloc()'s %lu, total free()'s %lu\n" +"\n" +msgstr "" +"[chiamate] totale re/malloc() %lu, totale free() %lu\n" +"\n" + +msgid "E341: Internal error: lalloc(0, )" +msgstr "E341: Errore interno: lalloc(0, )" + +msgid "E342: Out of memory! (allocating %lu bytes)" +msgstr "E342: Non c'è più memoria! (stavo allocando %lu byte)" + msgid "E163: There is only one file to edit" msgstr "E163: C'è un solo file da elaborare" @@ -79,8 +102,8 @@ msgstr "E680: : numero buffer non valido" msgid "E217: Can't execute autocommands for ALL events" msgstr "E217: Non posso eseguire autocomandi per TUTTI gli eventi" -msgid "No matching autocommands" -msgstr "Nessun autocomando corrispondente" +msgid "No matching autocommands: %s" +msgstr "Nessun autocomando corrispondente: %s" msgid "E218: autocommand nesting too deep" msgstr "E218: nidificazione dell'autocomando troppo estesa" @@ -178,16 +201,10 @@ msgstr[0] "%d buffer cancellato" msgstr[1] "%d buffer cancellati" msgid "E948: Job still running (add ! to end the job)" -msgstr "E948: Lavoro ancora in esecuzione (aggiungi! per terminarlo)" - -msgid "E37: No write since last change (add ! to override)" -msgstr "E37: Non salvato dopo modifica (aggiungi ! per eseguire comunque)" +msgstr "E948: Job ancora in esecuzione (aggiungi! per terminarlo)" msgid "E948: Job still running" -msgstr "E948: Lavoro ancora attivo" - -msgid "E37: No write since last change" -msgstr "E37: Non salvato dopo l'ultima modifica" +msgstr "E948: Job ancora attivo" msgid "W14: Warning: List of file names overflow" msgstr "W14: Avviso: Superato limite della lista dei nomi di file" @@ -507,11 +524,11 @@ msgstr "E821: File cifrato con metodo sconosciuto" msgid "Warning: Using a weak encryption method; see :help 'cm'" msgstr "Avviso: Metodo di cifratura debole in uso; vedere :help 'cm'" -msgid "" -"Note: Encryption of swapfile not supported, disabling swap- and undofile" +msgid "Note: Encryption of swapfile not supported, disabling swap file" msgstr "" -"Nota: La cifratura del file di swap non è supportata, swap e undo sono " -"disabilitati" +"Nota: La cifratura del file di swap non è supportata, file di swap " +"disabilitato" + msgid "Enter encryption key: " msgstr "Immetti chiave di cifratura: " @@ -997,7 +1014,7 @@ msgid "Save changes to \"%s\"?" msgstr "Salvare modifiche a \"%s\"?" msgid "E947: Job still running in buffer \"%s\"" -msgstr "E947: Lavoro ancora in esecuzione nel buffer \"%s\"" +msgstr "E947: Job ancora in esecuzione nel buffer \"%s\"" msgid "E162: No write since last change for buffer \"%s\"" msgstr "E162: Buffer \"%s\" non salvato dopo modifica" @@ -1029,15 +1046,15 @@ msgstr "Sto eseguendo: %s" msgid "E169: Command too recursive" msgstr "E169: Comando troppo ricorsivo" -msgid "E605: Exception not caught: %s" -msgstr "E605: Eccezione non intercettata: %s" - msgid "End of sourced file" msgstr "Fine del file di comandi" msgid "End of function" msgstr "Fine funzione" +msgid "E605: Exception not caught: %s" +msgstr "E605: Eccezione non intercettata: %s" + msgid "E492: Not an editor command" msgstr "E492: Non è un comando dell'editor" @@ -1192,9 +1209,6 @@ msgstr "E500: Il valore msgid "Untitled" msgstr "Senza Nome" -msgid "E196: No digraphs in this version" -msgstr "E196: Digrammi non supportati in questa versione" - msgid "E608: Cannot :throw exceptions with 'Vim' prefix" msgstr "E608: Impossibile lanciare eccezioni con prefisso 'Vim'" @@ -1931,27 +1945,9 @@ msgstr "E150: %s non msgid "E679: recursive loop loading syncolor.vim" msgstr "E679: ciclo ricorsivo nel caricamento di syncolor.vim" -msgid "E411: highlight group not found: %s" -msgstr "E411: gruppo evidenziazione non trovato: %s" - -msgid "E412: Not enough arguments: \":highlight link %s\"" -msgstr "E412: Argomenti non sufficienti: \":highlight link %s\"" - -msgid "E413: Too many arguments: \":highlight link %s\"" -msgstr "E413: Troppi argomenti: \":highlight link %s\"" - msgid "E414: group has settings, highlight link ignored" msgstr "E414: 'group' ha impostazioni, 'highlight link' ignorato" -msgid "E415: unexpected equal sign: %s" -msgstr "E415: segno '=' inatteso: %s" - -msgid "E416: missing equal sign: %s" -msgstr "E416: manca segno '=': %s" - -msgid "E417: missing argument: %s" -msgstr "E417: manca argomento: %s" - msgid "E418: Illegal value: %s" msgstr "E418: Valore non consentito: %s" @@ -1970,6 +1966,24 @@ msgstr "E421: Numero o nome di colore non riconosciuto: %s" msgid "E422: terminal code too long: %s" msgstr "E422: codice terminale troppo lungo: %s" +msgid "E411: highlight group not found: %s" +msgstr "E411: gruppo evidenziazione non trovato: %s" + +msgid "E412: Not enough arguments: \":highlight link %s\"" +msgstr "E412: Argomenti non sufficienti: \":highlight link %s\"" + +msgid "E413: Too many arguments: \":highlight link %s\"" +msgstr "E413: Troppi argomenti: \":highlight link %s\"" + +msgid "E415: unexpected equal sign: %s" +msgstr "E415: segno '=' inatteso: %s" + +msgid "E416: missing equal sign: %s" +msgstr "E416: manca segno '=': %s" + +msgid "E417: missing argument: %s" +msgstr "E417: manca argomento: %s" + msgid "E423: Illegal argument: %s" msgstr "E423: Argomento non consentito: %s" @@ -2378,6 +2392,7 @@ msgstr " Completamento Dizionario (^K^N^P)" msgid " Thesaurus completion (^T^N^P)" msgstr " Completamento Thesaurus (^T^N^P)" +#. CTRL_X_EVAL doesn't use msg. msgid " Command-line completion (^V^N^P)" msgstr " Completamento riga-di-comando (^V^N^P)" @@ -3581,15 +3596,6 @@ msgstr "" "&D Scarta Tutto\n" "&Cancella" -msgid "E766: Insufficient arguments for printf()" -msgstr "E766: Argomenti non sufficienti per printf()" - -msgid "E807: Expected Float argument for printf()" -msgstr "E807: Numero-a-virgola-mobile atteso come argomento per printf()" - -msgid "E767: Too many arguments to printf()" -msgstr "E767: Troppi argomenti per printf()" - msgid "Type number and or click with the mouse (q or empty cancels): " msgstr "" "Inserire un numero e dare o fare clic col mouse (q o vuoto per " @@ -3617,29 +3623,6 @@ msgstr "Beep!" msgid "E677: Error writing temp file" msgstr "E677: Errore in scrittura su file temporaneo" -msgid "ERROR: " -msgstr "ERRORE: " - -msgid "" -"\n" -"[bytes] total alloc-freed %lu-%lu, in use %lu, peak use %lu\n" -msgstr "" -"\n" -"[byte] totali alloc-rilasc %lu-%lu, in uso %lu, max uso %lu\n" - -msgid "" -"[calls] total re/malloc()'s %lu, total free()'s %lu\n" -"\n" -msgstr "" -"[chiamate] totale re/malloc() %lu, totale free() %lu\n" -"\n" - -msgid "E341: Internal error: lalloc(0, )" -msgstr "E341: Errore interno: lalloc(0, )" - -msgid "E342: Out of memory! (allocating %lu bytes)" -msgstr "E342: Non c'è più memoria! (stavo allocando %lu byte)" - msgid "Calling shell to execute: \"%s\"" msgstr "Chiamo la shell per eseguire: \"%s\"" @@ -3864,12 +3847,6 @@ msgstr "E531: Usa \":gui\" per far partire la GUI" msgid "E589: 'backupext' and 'patchmode' are equal" msgstr "E589: 'backupext' e 'patchmode' sono uguali" -msgid "E835: Conflicts with value of 'fillchars'" -msgstr "E835: Conflitto con il valore di 'fillchars'" - -msgid "E834: Conflicts with value of 'listchars'" -msgstr "E834: Conflitto con il valore di 'listchars'" - msgid "E617: Cannot be changed in the GTK+ 2 GUI" msgstr "E617: Non può essere cambiato nella GUI GTK+ 2" @@ -4239,15 +4216,6 @@ msgstr "E944: Intervallo invertito nella classe di caratteri" msgid "E945: Range too large in character class" msgstr "E945: Intervallo troppo ampio nella classe di caratteri" -msgid "E53: Unmatched %s%%(" -msgstr "E53: Senza riscontro: %s%%(" - -msgid "E54: Unmatched %s(" -msgstr "E54: Senza riscontro: %s(" - -msgid "E55: Unmatched %s)" -msgstr "E55: Senza riscontro: %s)" - msgid "E66: \\z( not allowed here" msgstr "E66: \\z( non consentito qui" @@ -4300,27 +4268,12 @@ msgstr "E678: Carattere non valido dopo %s%%[dxouU]" msgid "E71: Invalid character after %s%%" msgstr "E71: Carattere non valido dopo %s%%" -msgid "E59: invalid character after %s@" -msgstr "E59: Carattere non valido dopo %s@" - -msgid "E60: Too many complex %s{...}s" -msgstr "E60: Troppi %s{...}s complessi" - msgid "E61: Nested %s*" msgstr "E61: %s* nidificato" msgid "E62: Nested %s%c" msgstr "E62: %s%c nidificato" -msgid "E50: Too many \\z(" -msgstr "E50: Troppe \\z(" - -msgid "E51: Too many %s(" -msgstr "E51: Troppe %s(" - -msgid "E52: Unmatched \\z(" -msgstr "E52: Senza riscontro: \\z(" - msgid "E339: Pattern too long" msgstr "E339: Espressione troppo lunga" @@ -4960,6 +4913,15 @@ msgstr "Cambiare \"%.*s\" in:" msgid " < \"%.*s\"" msgstr " < \"%.*s\"" +msgid "E766: Insufficient arguments for printf()" +msgstr "E766: Argomenti non sufficienti per printf()" + +msgid "E807: Expected Float argument for printf()" +msgstr "E807: Numero-a-virgola-mobile atteso come argomento per printf()" + +msgid "E767: Too many arguments to printf()" +msgstr "E767: Troppi argomenti per printf()" + msgid "E390: Illegal argument: %s" msgstr "E390: Argomento non consentito: %s" @@ -5293,12 +5255,12 @@ msgstr "E964: Numero di colonna non valido: %ld" msgid "E966: Invalid line number: %ld" msgstr "E966: Numero di riga non valido: %ld" -msgid "E965: missing property type name" -msgstr "E965: Nome del tipo di proprietà non disponibile" - msgid "E275: Cannot add text property to unloaded buffer" msgstr "E275: Non posso aggiungere proprietà di testo a un buffer scaricato" +msgid "E965: missing property type name" +msgstr "E965: Nome del tipo di proprietà non disponibile" + msgid "E967: text property info corrupted" msgstr "E967: informazione sulle proprietà del testo corrotta" @@ -5362,7 +5324,7 @@ msgid "E894: Using a Dictionary as a Float" msgstr "E894: Uso di un Dizionario come un Numero-a-virgola-mobile" msgid "E362: Using a boolean value as a Float" -msgstr "E362: Uso di un valore booleano come un Numero-a-virgola-mobile" +msgstr "E362: Uso di un valore Booleano come un Numero-a-virgola-mobile" msgid "E907: Using a special value as a Float" msgstr "E907: Uso di un valore speciale come un Numero-a-virgola-mobile" @@ -5376,16 +5338,16 @@ msgstr "E914: Uso di un Canale come un Numero-a-virgola-mobile" msgid "E975: Using a Blob as a Float" msgstr "E975: Uso di un Blob come un Numero-a-virgola-mobile" -msgid "E729: using Funcref as a String" +msgid "E729: Using a Funcref as a String" msgstr "E729: Uso di una Funcref come una Stringa" -msgid "E730: using List as a String" +msgid "E730: Using a List as a String" msgstr "E730: Uso di una Lista come una Stringa" -msgid "E731: using Dictionary as a String" +msgid "E731: Using a Dictionary as a String" msgstr "E731: Uso di un Dizionario come una Stringa" -msgid "E976: using Blob as a String" +msgid "E976: Using a Blob as a String" msgstr "E976: Uso di un Blob come una Stringa" msgid "E977: Can only compare Blob with Blob" @@ -5598,9 +5560,6 @@ msgstr "" msgid "E841: Reserved name, cannot be used for user defined command" msgstr "E841: Nome riservato, non usabile in un comando definito dall'utente" -msgid "E184: No such user-defined command: %s" -msgstr "E184: Comando definito dall'utente %s inesistente" - msgid "E122: Function %s already exists, add ! to replace it" msgstr "E122: La funzione %s esiste già, aggiungi ! per sostituirla" @@ -6214,8 +6173,8 @@ msgstr "" "E299: Valorizzazione Perl non consentita in ambiente protetto senza il " "modulo Safe" -msgid "Edit with &multiple Vims" -msgstr "Apri con &molti Vim" +msgid "Edit with Vim using &tabpages" +msgstr "Apri con Vim usando &tabpages" msgid "Edit with single &Vim" msgstr "Apri con un solo &Vim" @@ -6243,9 +6202,6 @@ msgstr "" msgid "gvimext.dll error" msgstr "errore gvimext.dll" -msgid "Path length too long!" -msgstr "Percorso file troppo lungo!" - msgid "E10: \\ should be followed by /, ? or &" msgstr "E10: \\ dovrebbe essere seguito da /, ? oppure &" @@ -6293,12 +6249,120 @@ msgstr "E23: Nessun file alternato" msgid "E24: No such abbreviation" msgstr "E24: Abbreviazione inesistente" +msgid "E25: GUI cannot be used: Not enabled at compile time" +msgstr "E25: GUI non utilizzabile: Non abilitata in compilazione" + +msgid "E26: Hebrew cannot be used: Not enabled at compile time\n" +msgstr "E26: Ebraico non utilizzabile: Non abilitato in compilazione\n" + +msgid "E27: Farsi support has been removed\n" +msgstr "E27: Il supporto per la lingua farsi non è più disponibile\n" + +msgid "E28: No such highlight group name: %s" +msgstr "E28: Nome di gruppo di evidenziazione inesistente: %s" + +msgid "E29: No inserted text yet" +msgstr "E29: Ancora nessun testo inserito" + +msgid "E30: No previous command line" +msgstr "E30: Nessuna riga comandi precedente" + +msgid "E31: No such mapping" +msgstr "E31: Mappatura inesistente" + +msgid "E32: No file name" +msgstr "E32: Manca nome file" + +msgid "E33: No previous substitute regular expression" +msgstr "E33: Nessuna espressione regolare precedente di 'substitute'" + +msgid "E34: No previous command" +msgstr "E34: Nessun comando precedente" + +msgid "E35: No previous regular expression" +msgstr "E35: Nessuna espressione regolare precedente" + +msgid "E36: Not enough room" +msgstr "E36: Manca spazio" + +msgid "E37: No write since last change" +msgstr "E37: Non salvato dopo l'ultima modifica" + +msgid "E37: No write since last change (add ! to override)" +msgstr "E37: Non salvato dopo modifica (aggiungi ! per eseguire comunque)" + +msgid "E38: Null argument" +msgstr "E38: Argomento nullo" + +msgid "E39: Number expected" +msgstr "E39: Atteso un numero" + +msgid "E40: Can't open errorfile %s" +msgstr "E40: Non riesco ad aprire il file errori %s" + +msgid "E41: Out of memory!" +msgstr "E41: Non c'è più memoria!" + +msgid "E42: No Errors" +msgstr "E42: Nessun Errore" + +msgid "E43: Damaged match string" +msgstr "E43: Stringa di confronto danneggiata" + +msgid "E44: Corrupted regexp program" +msgstr "E44: Programma 'regexp' corrotto" + +msgid "E45: 'readonly' option is set (add ! to override)" +msgstr "E45: file in sola-lettura (aggiungi ! per eseguire comunque)" + +msgid "E46: Cannot change read-only variable \"%s\"" +msgstr "E46: Non posso cambiare la variabile read-only \"%s\"" + +msgid "E47: Error while reading errorfile" +msgstr "E47: Errore leggendo il file errori" + +msgid "E48: Not allowed in sandbox" +msgstr "E48: Non consentito in ambiente protetto" + +msgid "E49: Invalid scroll size" +msgstr "E49: Quantità di scorrimento non valida" + +msgid "E50: Too many \\z(" +msgstr "E50: Troppe \\z(" + +msgid "E51: Too many %s(" +msgstr "E51: Troppe %s(" + +msgid "E52: Unmatched \\z(" +msgstr "E52: Senza riscontro: \\z(" + +msgid "E53: Unmatched %s%%(" +msgstr "E53: Senza riscontro: %s%%(" + +msgid "E54: Unmatched %s(" +msgstr "E54: Senza riscontro: %s(" + +msgid "E55: Unmatched %s)" +msgstr "E55: Senza riscontro: %s)" + +msgid "E59: invalid character after %s@" +msgstr "E59: Carattere non valido dopo %s@" + +msgid "E60: Too many complex %s{...}s" +msgstr "E60: Troppi %s{...}s complessi" + msgid "E121: Undefined variable: %s" msgstr "E121: Variabile non definita: %s" msgid "E121: Undefined variable: %c:%s" msgstr "E121: Variabile non definita: %c:%s" +msgid "E184: No such user-defined command: %s" +msgstr "E184: Comando definito dall'utente %s inesistente" + +msgid "E196: No digraphs in this version" +msgstr "E196: Digrammi non supportati in questa versione" + msgid "E464: Ambiguous use of user-defined command" msgstr "E464: Uso ambiguo di comando definito dall'utente" @@ -6317,6 +6381,12 @@ msgstr "E711: Il valore della Lista non ha elementi sufficienti" msgid "E719: Cannot slice a Dictionary" msgstr "E719: Non posso suddividere un Dizionario" +msgid "E834: Conflicts with value of 'listchars'" +msgstr "E834: Conflitto con il valore di 'listchars'" + +msgid "E835: Conflicts with value of 'fillchars'" +msgstr "E835: Conflitto con il valore di 'fillchars'" + msgid "" "E856: \"assert_fails()\" second argument must be a string or a list with one " "or two strings" @@ -6369,10 +6439,17 @@ msgstr "E1011: Nome troppo lungo: %s" msgid "E1012: Type mismatch; expected %s but got %s" msgstr "E1012: Tipo non corrispondente; atteso %s, ma ottenuto %s" +msgid "E1012: Type mismatch; expected %s but got %s in %s" +msgstr "E1012: Tipo non corrispondente; atteso %s, ma ottenuto %s in %s" + msgid "E1013: Argument %d: type mismatch, expected %s but got %s" msgstr "" "E1013: Argomento %d: tipo non corrispondente, atteso %s, ma ottenuto %s" +msgid "E1013: Argument %d: type mismatch, expected %s but got %s in %s" +msgstr "" +"E1013: Argomento %d: tipo non corrispondente, atteso %s, ma ottenuto %s in %s" + msgid "E1014: Invalid key: %s" msgstr "E1014: Chiave non valida: %s" @@ -6476,8 +6553,8 @@ msgstr "E1045: Manca \"as\" dopo *" msgid "E1046: Missing comma in import" msgstr "E1046: Manca virgola in import" -msgid "E1047: Syntax error in import" -msgstr "E1047: Errore di sintassi in import" +msgid "E1047: Syntax error in import: %s" +msgstr "E1047: Errore di sintassi in import: %s" msgid "E1048: Item not found in script: %s" msgstr "E1048: Elemento non trovato nello script: %s" @@ -6615,6 +6692,9 @@ msgstr "" msgid "E1097: Line incomplete" msgstr "E1097: Riga incompleta" +msgid "E1098: String, List or Blob required" +msgstr "E1098: Necessaria Stringa, Lista, o Blob" + msgid "E1099: Unknown error while executing %s" msgstr "E1099: Errore sconosciuto mentre era in esecuzione %s" @@ -6786,8 +6866,8 @@ msgstr "E1151: :endfunction senza corrispondenza" msgid "E1152: Mismatched enddef" msgstr "E1152: :enddef senza corrispondenza" -msgid "E1153: Invalid operation for bool" -msgstr "E1153: Operazione non valida per un valore Booleano" +msgid "E1153: Invalid operation for %s" +msgstr "E1153: Operazione non valida per %s" msgid "E1154: Divide by zero" msgstr "E1154: Divisione per zero" @@ -6822,6 +6902,10 @@ msgid "E1163: Variable %d: type mismatch, expected %s but got %s" msgstr "" "E1163: Variabile %d: tipo non corrispondente, atteso %s, ma ottenuto %s" +msgid "E1163: Variable %d: type mismatch, expected %s but got %s in %s" +msgstr "" +"E1163: Variabile %d: tipo non corrispondente, atteso %s, ma ottenuto %s in %s" + msgid "E1164: vim9cmd must be followed by a command" msgstr "E1164: vim9cmd dev'essere seguito da un comando" @@ -6853,10 +6937,10 @@ msgid "E1173: Text found after enddef: %s" msgstr "E1173: Trovato del testo dopo enddef: %s" msgid "E1174: String required for argument %d" -msgstr "E1174: Una Stringa richiesta per argomento %d" +msgstr "E1174: Stringa richiesta per argomento %d" msgid "E1175: Non-empty string required for argument %d" -msgstr "E1175: Una Stringa non vuota richiesta come argomento %d" +msgstr "E1175: Stringa non vuota richiesta come argomento %d" msgid "E1176: Misplaced command modifier" msgstr "E1176: Modificatore di comando fuori posto" @@ -6922,20 +7006,18 @@ msgid "E1192: Empty function name" msgstr "E1192: Nome funzione vuoto" msgid "E1193: cryptmethod xchacha20 not built into this Vim" -msgstr "E1193: Metodo di cifratura xchacha20 non disponibile in questa " -"versione di Vim" +msgstr "" +"E1193: Metodo di cifratura xchacha20 non disponibile in questa versione di " +"Vim" msgid "E1194: Cannot encrypt header, not enough space" -msgstr "" -"E1194: Impossibile cifrare intestazione, non c'è spazio sufficiente" +msgstr "E1194: Impossibile cifrare intestazione, non c'è spazio sufficiente" msgid "E1195: Cannot encrypt buffer, not enough space" -msgstr "" -"E1195: Impossibile cifrare buffer, non c'è spazio sufficiente" +msgstr "E1195: Impossibile cifrare buffer, non c'è spazio sufficiente" msgid "E1196: Cannot decrypt header, not enough space" -msgstr "" -"E1196: Impossibile decifrare intestazione, non c'è spazio sufficiente" +msgstr "E1196: Impossibile decifrare intestazione, non c'è spazio sufficiente" msgid "E1197: Cannot allocate_buffer for encryption" msgstr "E1197: Fallita chiamata ad allocate_buffer per la cifratura" @@ -6944,8 +7026,7 @@ msgid "E1198: Decryption failed: Header incomplete!" msgstr "E1198: Decifrazione fallita: Intestazione incompleta!" msgid "E1199: Cannot decrypt buffer, not enough space" -msgstr "" -"E1199: Impossibile decifrare intestazione, non c'è spazio sufficiente" +msgstr "E1199: Impossibile decifrare intestazione, non c'è spazio sufficiente" msgid "E1200: Decryption failed!" msgstr "E1200: Decifrazione fallita!" @@ -6959,6 +7040,128 @@ msgstr "E1202: Nessuno spazio bianco consentito dopo '%s': %s" msgid "E1203: Dot can only be used on a dictionary: %s" msgstr "E1203: Il punto può essere usato solo in un dizionario: %s" +msgid "E1204: No Number allowed after .: '\\%%%c'" +msgstr "E1204: Nessun Numero consentito dopo .: '\\%%%c'" + +msgid "E1205: No white space allowed between option and" +msgstr "E1205: Nessuno spazio bianco consentito tra l'opzione e" + +msgid "E1206: Dictionary required for argument %d" +msgstr "E1206: Dizionario richiesto per argomento %d" + +msgid "E1207: Expression without an effect: %s" +msgstr "E1207: Expressione che non produce alcun effetto: %s" + +msgid "E1208: -complete used without allowing arguments" +msgstr "E1208: -complete usato senza conetntire alcun argomento" + +msgid "E1209: Invalid value for a line number: \"%s\"" +msgstr "E1209: Valore non valido come numero di riga: \"%s\"" + +msgid "E1210: Number required for argument %d" +msgstr "E1210: Numero richiesto per argomento %d" + +msgid "E1211: List required for argument %d" +msgstr "E1211: Una Lista richiesta per argomento %d" + +msgid "E1212: Bool required for argument %d" +msgstr "E1212: Valore Booleano richiesto per argomento %d" + +msgid "E1213: Redefining imported item \"%s\"" +msgstr "E1213: Ridefinisco elemento importato \"%s\"" + +msgid "E1214: Digraph must be just two characters: %s" +msgstr "E1214: Il digramma dev'essere formato da due soli caratteri: %s" + +msgid "E1215: Digraph must be one character: %s" +msgstr "E1215: Il digramma dev'essere formato da un solo carattere: %s" + +msgid "" +"E1216: digraph_setlist() argument must be a list of lists with two items" +msgstr "" +"E1216: l'argomento a digraph_setlist() dev'essere una Lista di Liste con due elementi" + +msgid "E1217: Channel or Job required for argument %d" +msgstr "E1217: Canale o Job richiesto per argomento %d" + +msgid "E1218: Job required for argument %d" +msgstr "E1218: Job richiesto per argomento %d" + +msgid "E1219: Float or Number required for argument %d" +msgstr "E1219: Numero-a-virgola-mobile o Numero richiesto per argomento %d" + +msgid "E1220: String or Number required for argument %d" +msgstr "E1220: Stringa o Numero richiesto per argomento %d" + +msgid "E1221: String or Blob required for argument %d" +msgstr "E1221: Stringa o Blob richiesto per argomento %d" + +msgid "E1222: String or List required for argument %d" +msgstr "E1222: Stringa o Lista richiesta per argomento %d" + +msgid "E1223: String or Dictionary required for argument %d" +msgstr "E1223: String o Dizionario richiesto per argomento %d" + +msgid "E1224: String, Number or List required for argument %d" +msgstr "E1224: Stringa, Numero o Lista richiesto per argomento %d" + +msgid "E1225: String, List or Dictionary required for argument %d" +msgstr "E1225: Stringa, Lista o Dizionario richiesto per argomento %d" + +msgid "E1226: List or Blob required for argument %d" +msgstr "E1226: Lista o Blob richiesto per argomento %d" + +msgid "E1227: List or Dictionary required for argument %d" +msgstr "E1227: Lista o Dizionario richiesto per argomento %d" + +msgid "E1228: List, Dictionary or Blob required for argument %d" +msgstr "E1228: Lista, Dizionario o Blob richiesto per argomento %d" + +msgid "E1229: Expected dictionary for using key \"%s\", but got %s" +msgstr "E1229: Atteso Dizionario per usare chiave \"%s\", ma ottenuto %s" + +msgid "E1230: Encryption: sodium_mlock() failed" +msgstr "E1230: CIfratura: sodium_mlock() fallita" + +msgid "E1231: Cannot use a bar to separate commands here: %s" +msgstr "E1231: Non si può usare una barra per separare comandi qui: %s" + +msgid "E1232: Argument of exists_compiled() must be a literal string" +msgstr "E1232: L'argomento di exists_compiled() dev'essere una stringa di caratteri" + +msgid "E1233: exists_compiled() can only be used in a :def function" +msgstr "E1233: exists_compiled() si può usare solo in una funzione :def" + +msgid "E1234: legacy must be followed by a command" +msgstr "E1234: legacy dev'essere seguito da un comando" + +msgid "E1235: Function reference is not set" +msgstr "E1235: Riferimento di funzione non impostato" + +msgid "E1236: Cannot use %s itself, it is imported with '*'" +msgstr "E1236: Non posso usare %s stesso, è importato con '*'" + +msgid "E1237: No such user-defined command in current buffer: %s" +msgstr "E1237: Questo comando utente non c'è nel buffer corrente: %s" + +msgid "E1238: Blob required for argument %d" +msgstr "E1238: Blob richiesto per argomento %d" + +msgid "E1239: Invalid value for blob: %d" +msgstr "E1239: Valore non valido per blob: %d" + +msgid "E1240: Resulting text too long" +msgstr "E1240: Testo risultante troppo lungo" + +msgid "E1241: Separator not supported: %s" +msgstr "E1241: Separatore nod supportato: %s" + +msgid "E1242: No white space allowed before separator: %s" +msgstr "E1242: Nessuno spazio bianco consentito prima del separatore: %s" + +msgid "E1243: ASCII code not in 32-127 range" +msgstr "E1243: codice ASCII non nell'intervallo 32-127" + msgid "--No lines in buffer--" msgstr "--File vuoto--" @@ -7047,60 +7250,27 @@ msgstr "E364: Chiamata a libreria fallita per \"%s()\"" msgid "E667: Fsync failed" msgstr "E667: Fsync fallito" +msgid "E370: Could not load library %s: %s" +msgstr "E370: Non riesco a caricare la libreria %s: %s" + msgid "E448: Could not load library function %s" msgstr "E448: Non posso caricare la funzione di libreria %s" msgid "E477: No ! allowed" msgstr "E477: ! non consentito" -msgid "E25: GUI cannot be used: Not enabled at compile time" -msgstr "E25: GUI non utilizzabile: Non abilitata in compilazione" - -msgid "E26: Hebrew cannot be used: Not enabled at compile time\n" -msgstr "E26: Ebraico non utilizzabile: Non abilitato in compilazione\n" - -msgid "E27: Farsi support has been removed\n" -msgstr "E27: Il supporto per la lingua farsi non è più disponibile\n" - msgid "E800: Arabic cannot be used: Not enabled at compile time\n" msgstr "E800: Arabo non utilizzabile: Non abilitato in compilazione\n" -msgid "E28: No such highlight group name: %s" -msgstr "E28: Nome di gruppo di evidenziazione inesistente: %s" - -msgid "E29: No inserted text yet" -msgstr "E29: Ancora nessun testo inserito" - -msgid "E30: No previous command line" -msgstr "E30: Nessuna riga comandi precedente" - -msgid "E31: No such mapping" -msgstr "E31: Mappatura inesistente" - msgid "E479: No match" msgstr "E479: Nessuna corrispondenza" msgid "E480: No match: %s" msgstr "E480: Nessuna corrispondenza: %s" -msgid "E32: No file name" -msgstr "E32: Manca nome file" - -msgid "E33: No previous substitute regular expression" -msgstr "E33: Nessuna espressione regolare precedente di 'substitute'" - -msgid "E34: No previous command" -msgstr "E34: Nessun comando precedente" - -msgid "E35: No previous regular expression" -msgstr "E35: Nessuna espressione regolare precedente" - msgid "E481: No range allowed" msgstr "E481: Nessun intervallo consentito" -msgid "E36: Not enough room" -msgstr "E36: Manca spazio" - msgid "E247: no registered server named \"%s\"" msgstr "E247: non esiste server registrato con nome \"%s\"" @@ -7116,21 +7286,9 @@ msgstr "E484: Non riesco ad aprire il file %s" msgid "E485: Can't read file %s" msgstr "E485: Non riesco a leggere il file %s" -msgid "E38: Null argument" -msgstr "E38: Argomento nullo" - -msgid "E39: Number expected" -msgstr "E39: Atteso un numero" - -msgid "E40: Can't open errorfile %s" -msgstr "E40: Non riesco ad aprire il file errori %s" - msgid "E233: cannot open display" msgstr "E233: non riesco ad aprire lo schermo" -msgid "E41: Out of memory!" -msgstr "E41: Non c'è più memoria!" - msgid "Pattern not found" msgstr "Espressione non trovata" @@ -7143,21 +7301,9 @@ msgstr "E487: L'argomento dev'essere positivo" msgid "E459: Cannot go back to previous directory" msgstr "E459: Non posso tornare alla directory precedente" -msgid "E42: No Errors" -msgstr "E42: Nessun Errore" - msgid "E776: No location list" msgstr "E776: Nessuna lista locazioni" -msgid "E43: Damaged match string" -msgstr "E43: Stringa di confronto danneggiata" - -msgid "E44: Corrupted regexp program" -msgstr "E44: Programma 'regexp' corrotto" - -msgid "E45: 'readonly' option is set (add ! to override)" -msgstr "E45: file in sola-lettura (aggiungi ! per eseguire comunque)" - msgid "E734: Wrong variable type for %s=" msgstr "E734: Tipo di variabile errato per %s=" @@ -7167,9 +7313,6 @@ msgstr "E461: Nome di variabile non consentito: %s" msgid "E995: Cannot modify existing variable" msgstr "E995: Non posso modificare una variabile esistente" -msgid "E46: Cannot change read-only variable \"%s\"" -msgstr "E46: Non posso cambiare la variabile read-only \"%s\"" - msgid "E794: Cannot set variable in the sandbox: \"%s\"" msgstr "" "E794: Non posso impostare la variabile read-only in ambiente protetto: \"%s\"" @@ -7177,8 +7320,14 @@ msgstr "" msgid "E928: String required" msgstr "E928: Stringa necessaria" +msgid "E889: Number required" +msgstr "E889: Numero richiesto" + +msgid "E839: Bool required" +msgstr "E839: Valore Boleano richiesto" + msgid "E713: Cannot use empty key for Dictionary" -msgstr "E713: Non posso usare una chiave nulla per il Dizionario" +msgstr "E713: Non posso usare una chiave nulla per Dizionario" msgid "E715: Dictionary required" msgstr "E715: È necessario un Dizionario" @@ -7235,12 +7384,6 @@ msgstr "" msgid "E857: Dictionary key \"%s\" required" msgstr "E857: Chiave di Dizionario \"%s\" richiesta" -msgid "E47: Error while reading errorfile" -msgstr "E47: Errore leggendo il file errori" - -msgid "E48: Not allowed in sandbox" -msgstr "E48: Non consentito in ambiente protetto" - msgid "E523: Not allowed here" msgstr "E523: Non consentito qui" @@ -7253,9 +7396,6 @@ msgstr "E565: Non msgid "E359: Screen mode setting not supported" msgstr "E359: Impostazione modalità schermo non supportata" -msgid "E49: Invalid scroll size" -msgstr "E49: Quantità di scorrimento non valida" - msgid "E91: 'shell' option is empty" msgstr "E91: opzione 'shell' non impostata" @@ -7412,6 +7552,12 @@ msgstr "E940: Non riesco a bloccare o sbloccare la variabile %s" msgid "E254: Cannot allocate color %s" msgstr "E254: Non riesco ad allocare il colore %s" +msgid "E706: Channel or Job required" +msgstr "E706: Canale o Job richiesto" + +msgid "E693: Job required" +msgstr "E693: Job richiesto" + msgid "search hit TOP, continuing at BOTTOM" msgstr "raggiunta la CIMA nella ricerca, continuo dal FONDO" @@ -9168,3 +9314,9 @@ msgstr "nome della libreria dinamica MzScheme" msgid "name of the MzScheme GC dynamic library" msgstr "nome della libreria dinamica MzScheme GC" + +#~ msgid "Edit with &multiple Vims" +#~ msgstr "Apri con &molti Vim" + +#~ msgid "Path length too long!" +#~ msgstr "Percorso file troppo lungo!" From ee56f3f119c4378a5b62b4d504cff3373b363308 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 23 Oct 2021 12:34:27 +0100 Subject: [PATCH 12/15] patch 8.2.3559: loop variable recreated every time Problem: Loop variable recreated every time. Solution: Keep the loop variable when looping. --- src/ex_eval.c | 5 +++-- src/version.c | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/ex_eval.c b/src/ex_eval.c index 1142280bae..1f66e336f6 100644 --- a/src/ex_eval.c +++ b/src/ex_eval.c @@ -1191,8 +1191,9 @@ ex_while(exarg_T *eap) & CSF_FUNC_DEF; // Any variables defined in the previous round are no longer - // visible. - for (i = cstack->cs_script_var_len[cstack->cs_idx]; + // visible. Keep the first one, it is the loop variable that + // we reuse every time around. + for (i = cstack->cs_script_var_len[cstack->cs_idx] + 1; i < si->sn_var_vals.ga_len; ++i) { svar_T *sv = ((svar_T *)si->sn_var_vals.ga_data) + i; diff --git a/src/version.c b/src/version.c index 53ceef0bf6..4381877f35 100644 --- a/src/version.c +++ b/src/version.c @@ -757,6 +757,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 3559, /**/ 3558, /**/ From 844fb64a605d60131827503a001b2d1aa232b078 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 23 Oct 2021 13:32:30 +0100 Subject: [PATCH 13/15] patch 8.2.3560: using freed memory with lambda Problem: Using freed memory with lambda. Solution: Do not free lines early, keep them until the expression is finished. --- src/eval.c | 23 ++++++++++++++++------- src/globals.h | 4 ++-- src/proto/eval.pro | 1 + src/structs.h | 7 +++++-- src/testdir/test_vim9_func.vim | 20 ++++++++++++++++++++ src/userfunc.c | 11 ++++++++--- src/version.c | 2 ++ src/vim9compile.c | 15 +++++++++------ 8 files changed, 63 insertions(+), 20 deletions(-) diff --git a/src/eval.c b/src/eval.c index aceba5e2d7..41291a2441 100644 --- a/src/eval.c +++ b/src/eval.c @@ -143,7 +143,7 @@ eval_clear(void) void fill_evalarg_from_eap(evalarg_T *evalarg, exarg_T *eap, int skip) { - CLEAR_FIELD(*evalarg); + init_evalarg(evalarg); evalarg->eval_flags = skip ? 0 : EVAL_EVALUATE; if (eap != NULL) { @@ -2137,8 +2137,7 @@ eval_next_line(evalarg_T *evalarg) // Advanced to the next line, "arg" no longer points into the previous // line. - VIM_CLEAR(evalarg->eval_tofree_cmdline); - + evalarg->eval_using_cmdline = FALSE; return skipwhite(line); } @@ -2159,6 +2158,16 @@ skipwhite_and_linebreak(char_u *arg, evalarg_T *evalarg) return p; } +/* + * Initialize "evalarg" for use. + */ + void +init_evalarg(evalarg_T *evalarg) +{ + CLEAR_POINTER(evalarg); + ga_init2(&evalarg->eval_tofree_ga, sizeof(char_u *), 20); +} + /* * After using "evalarg" filled from "eap": free the memory. */ @@ -2183,7 +2192,7 @@ clear_evalarg(evalarg_T *evalarg, exarg_T *eap) evalarg->eval_tofree = NULL; } - VIM_CLEAR(evalarg->eval_tofree_cmdline); + ga_clear_strings(&evalarg->eval_tofree_ga); VIM_CLEAR(evalarg->eval_tofree_lambda); } } @@ -2298,7 +2307,7 @@ eval1(char_u **arg, typval_T *rettv, evalarg_T *evalarg) if (evalarg == NULL) { - CLEAR_FIELD(local_evalarg); + init_evalarg(&local_evalarg); evalarg_used = &local_evalarg; } orig_flags = evalarg_used->eval_flags; @@ -2455,7 +2464,7 @@ eval2(char_u **arg, typval_T *rettv, evalarg_T *evalarg) if (evalarg == NULL) { - CLEAR_FIELD(local_evalarg); + init_evalarg(&local_evalarg); evalarg_used = &local_evalarg; } orig_flags = evalarg_used->eval_flags; @@ -2581,7 +2590,7 @@ eval3(char_u **arg, typval_T *rettv, evalarg_T *evalarg) if (evalarg == NULL) { - CLEAR_FIELD(local_evalarg); + init_evalarg(&local_evalarg); evalarg_used = &local_evalarg; } orig_flags = evalarg_used->eval_flags; diff --git a/src/globals.h b/src/globals.h index 4a6e027486..948c35f84f 100644 --- a/src/globals.h +++ b/src/globals.h @@ -1867,8 +1867,8 @@ EXTERN listitem_T range_list_item; // Passed to an eval() function to enable evaluation. EXTERN evalarg_T EVALARG_EVALUATE # ifdef DO_INIT - = {EVAL_EVALUATE, 0, NULL, NULL, NULL, NULL, {0, 0, 0, 0, NULL}, - {0, 0, 0, 0, NULL}, NULL, NULL, NULL} + = {EVAL_EVALUATE, 0, NULL, NULL, NULL, NULL, GA_EMPTY, GA_EMPTY, NULL, + {0, 0, (int)sizeof(char_u *), 20, NULL}, 0, NULL} # endif ; #endif diff --git a/src/proto/eval.pro b/src/proto/eval.pro index ed19c929cb..96a2c6d1e6 100644 --- a/src/proto/eval.pro +++ b/src/proto/eval.pro @@ -34,6 +34,7 @@ void free_for_info(void *fi_void); void set_context_for_expression(expand_T *xp, char_u *arg, cmdidx_T cmdidx); int pattern_match(char_u *pat, char_u *text, int ic); char_u *skipwhite_and_linebreak(char_u *arg, evalarg_T *evalarg); +void init_evalarg(evalarg_T *evalarg); void clear_evalarg(evalarg_T *evalarg, exarg_T *eap); int eval0(char_u *arg, typval_T *rettv, exarg_T *eap, evalarg_T *evalarg); int eval1(char_u **arg, typval_T *rettv, evalarg_T *evalarg); diff --git a/src/structs.h b/src/structs.h index 114135a171..8ffebf3126 100644 --- a/src/structs.h +++ b/src/structs.h @@ -1906,8 +1906,11 @@ typedef struct { // pointer to the last line obtained with getsourceline() char_u *eval_tofree; - // pointer to the last line of an inline function - char_u *eval_tofree_cmdline; + // array with lines of an inline function + garray_T eval_tofree_ga; + + // set when "arg" points into the last entry of "eval_tofree_ga" + int eval_using_cmdline; // pointer to the lines concatenated for a lambda. char_u *eval_tofree_lambda; diff --git a/src/testdir/test_vim9_func.vim b/src/testdir/test_vim9_func.vim index dda812d8f6..3d1ae26803 100644 --- a/src/testdir/test_vim9_func.vim +++ b/src/testdir/test_vim9_func.vim @@ -1133,6 +1133,26 @@ def Test_pass_legacy_lambda_to_def_func() CheckScriptSuccess(lines) enddef +def Test_lambda_in_reduce_line_break() + # this was using freed memory + var lines =<< trim END + vim9script + const result: dict = + ['Bob', 'Sam', 'Cat', 'Bob', 'Cat', 'Cat'] + ->reduce((acc, val) => { + if has_key(acc, val) + acc[val] += 1 + return acc + else + acc[val] = 1 + return acc + endif + }, {}) + assert_equal({Bob: 2, Sam: 1, Cat: 3}, result) + END + CheckScriptSuccess(lines) +enddef + " Default arg and varargs def MyDefVarargs(one: string, two = 'foo', ...rest: list): string var res = one .. ',' .. two diff --git a/src/userfunc.c b/src/userfunc.c index 9784871128..2f0637e7db 100644 --- a/src/userfunc.c +++ b/src/userfunc.c @@ -1177,12 +1177,17 @@ lambda_function_body( if (cmdline != NULL) { + garray_T *tfgap = &evalarg->eval_tofree_ga; + // Something comes after the "}". *arg = eap.nextcmd; // "arg" points into cmdline, need to keep the line and free it later. - vim_free(evalarg->eval_tofree_cmdline); - evalarg->eval_tofree_cmdline = cmdline; + if (ga_grow(tfgap, 1) == OK) + { + ((char_u **)(tfgap->ga_data))[tfgap->ga_len++] = cmdline; + evalarg->eval_using_cmdline = TRUE; + } } else *arg = (char_u *)""; @@ -4867,7 +4872,7 @@ ex_return(exarg_T *eap) return; } - CLEAR_FIELD(evalarg); + init_evalarg(&evalarg); evalarg.eval_flags = eap->skip ? 0 : EVAL_EVALUATE; if (eap->skip) diff --git a/src/version.c b/src/version.c index 4381877f35..a1714ebf9a 100644 --- a/src/version.c +++ b/src/version.c @@ -757,6 +757,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 3560, /**/ 3559, /**/ diff --git a/src/vim9compile.c b/src/vim9compile.c index effd610ab8..303b1e3127 100644 --- a/src/vim9compile.c +++ b/src/vim9compile.c @@ -3702,7 +3702,7 @@ compile_lambda(char_u **arg, cctx_T *cctx) ufunc_T *ufunc; evalarg_T evalarg; - CLEAR_FIELD(evalarg); + init_evalarg(&evalarg); evalarg.eval_flags = EVAL_EVALUATE; evalarg.eval_cctx = cctx; @@ -3733,11 +3733,13 @@ compile_lambda(char_u **arg, cctx_T *cctx) compile_def_function(ufunc, FALSE, CT_NONE, cctx); #endif - // evalarg.eval_tofree_cmdline may have a copy of the last line and "*arg" - // points into it. Point to the original line to avoid a dangling pointer. - if (evalarg.eval_tofree_cmdline != NULL) + // The last entry in evalarg.eval_tofree_ga is a copy of the last line and + // "*arg" may point into it. Point into the original line to avoid a + // dangling pointer. + if (evalarg.eval_using_cmdline) { - size_t off = *arg - evalarg.eval_tofree_cmdline; + garray_T *gap = &evalarg.eval_tofree_ga; + size_t off = *arg - ((char_u **)gap->ga_data)[gap->ga_len - 1]; *arg = ((char_u **)cctx->ctx_ufunc->uf_lines.ga_data)[cctx->ctx_lnum] + off; @@ -4201,9 +4203,10 @@ skip_expr_cctx(char_u **arg, cctx_T *cctx) { evalarg_T evalarg; - CLEAR_FIELD(evalarg); + init_evalarg(&evalarg); evalarg.eval_cctx = cctx; skip_expr(arg, &evalarg); + clear_evalarg(&evalarg, NULL); } /* From 3c5904d2a5d7861c227a4c3cd4ddcbc51014c838 Mon Sep 17 00:00:00 2001 From: James McCoy Date: Sun, 24 Oct 2021 14:50:07 +0100 Subject: [PATCH 14/15] patch 8.2.3561: cscope has a complicated way of giving an error message Problem: Cscope has a complicated way of giving an error message. Solution: Use semsg(). (James McCoy, closes #9038) --- src/if_cscope.c | 44 +++++--------------------------------------- src/version.c | 2 ++ 2 files changed, 7 insertions(+), 39 deletions(-) diff --git a/src/if_cscope.c b/src/if_cscope.c index 7117a253f7..d587587c42 100644 --- a/src/if_cscope.c +++ b/src/if_cscope.c @@ -462,17 +462,8 @@ cs_add(exarg_T *eap UNUSED) static void cs_stat_emsg(char *fname) { - char *stat_emsg = _("E563: stat(%s) error: %d"); - char *buf = alloc(strlen(stat_emsg) + MAXPATHL + 10); - - if (buf != NULL) - { - (void)sprintf(buf, stat_emsg, fname, errno); - (void)emsg(buf); - vim_free(buf); - } - else - (void)emsg(_("E563: stat error")); + int err = errno; + (void)semsg(_("E563: stat(%s) error: %d"), fname, err); } @@ -1114,16 +1105,7 @@ cs_find_common( // next symbol must be + or - if (strchr(CSQF_FLAGS, *qfpos) == NULL) { - char *nf = _("E469: invalid cscopequickfix flag %c for %c"); - char *buf = alloc(strlen(nf)); - - // strlen will be enough because we use chars - if (buf != NULL) - { - sprintf(buf, nf, *qfpos, *(qfpos-1)); - (void)emsg(buf); - vim_free(buf); - } + (void)semsg(_("E469: invalid cscopequickfix flag %c for %c"), *qfpos, *(qfpos - 1)); return FALSE; } @@ -1177,24 +1159,8 @@ cs_find_common( if (totmatches == 0) { - char *nf = _("E259: no matches found for cscope query %s of %s"); - char *buf; - - if (!verbose) - { - vim_free(nummatches); - return FALSE; - } - - buf = alloc(strlen(opt) + strlen(pat) + strlen(nf)); - if (buf == NULL) - (void)emsg(nf); - else - { - sprintf(buf, nf, opt, pat); - (void)emsg(buf); - vim_free(buf); - } + if (verbose) + (void)semsg(_("E259: no matches found for cscope query %s of %s"), opt, pat); vim_free(nummatches); return FALSE; } diff --git a/src/version.c b/src/version.c index a1714ebf9a..7dc55ac95a 100644 --- a/src/version.c +++ b/src/version.c @@ -757,6 +757,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 3561, /**/ 3560, /**/ From e30d10253fa634c4f60daa798d029245f4eed393 Mon Sep 17 00:00:00 2001 From: Drew Vogel Date: Sun, 24 Oct 2021 20:35:07 +0100 Subject: [PATCH 15/15] patch 8.2.3562: cannot add color names Problem: Cannot add color names. Solution: Add the v:colornames dictionary. (Drew Vogel, closes #8761) --- Filelist | 2 +- READMEdir/README_extra.txt | 1 - nsis/gvim.nsi | 3 +- runtime/colors/README.txt | 3 +- runtime/colors/lists/csscolors.vim | 166 ++++++ runtime/colors/lists/default.vim | 801 +++++++++++++++++++++++++++++ runtime/doc/eval.txt | 37 ++ runtime/doc/gui_w32.txt | 18 +- runtime/doc/message.txt | 5 + runtime/doc/os_haiku.txt | 5 +- runtime/doc/syntax.txt | 29 +- runtime/doc/usr_06.txt | 25 +- src/Makefile | 11 +- src/errors.h | 6 + src/evalvars.c | 3 + src/globals.h | 3 - src/gui.c | 2 +- src/gui_haiku.cc | 159 +----- src/highlight.c | 233 ++++++++- src/job.c | 2 +- src/proto/highlight.pro | 6 + src/proto/term.pro | 2 - src/term.c | 199 +------ src/testdir/test_highlight.vim | 36 ++ src/version.c | 2 + src/vim.h | 3 +- 26 files changed, 1364 insertions(+), 398 deletions(-) create mode 100644 runtime/colors/lists/csscolors.vim create mode 100644 runtime/colors/lists/default.vim diff --git a/Filelist b/Filelist index 34285eb3b6..01c388bd49 100644 --- a/Filelist +++ b/Filelist @@ -798,6 +798,7 @@ RT_SCRIPTS = \ runtime/autoload/xml/*.vim \ runtime/colors/*.vim \ runtime/colors/README.txt \ + runtime/colors/lists/*.vim \ runtime/colors/tools/*.vim \ runtime/compiler/*.vim \ runtime/compiler/README.txt \ @@ -850,7 +851,6 @@ RT_AMI_DOS = \ # DOS runtime (also in the extra archive) RT_DOS = \ README_dos.txt \ - runtime/rgb.txt \ vimtutor.bat \ # DOS runtime without CR-LF translation (also in the extra archive) diff --git a/READMEdir/README_extra.txt b/READMEdir/README_extra.txt index 4f22d1bcc2..94d93f986b 100644 --- a/READMEdir/README_extra.txt +++ b/READMEdir/README_extra.txt @@ -26,7 +26,6 @@ src/os_win32.* Files for the Win32 port. src/gui_w32.* Files for the Win32 GUI. src/gui_w48.* Files for the Win32 and Win16 GUI. src/Make_mvc.mak MS Visual C++ makefile for the Win32 GUI. -runtime/rgb.txt File with color definitions for the Win32 GUI. src/if_ole.* OLE automation interface, for MS Windows 95 and NT. diff --git a/nsis/gvim.nsi b/nsis/gvim.nsi index fc5713f790..649c6950dd 100644 --- a/nsis/gvim.nsi +++ b/nsis/gvim.nsi @@ -357,7 +357,6 @@ Section "$(str_section_exe)" id_section_exe File ..\README.txt File ..\uninstall.txt File ${VIMRT}\*.vim - File ${VIMRT}\rgb.txt File ${VIMTOOLS}\diff.exe File ${VIMTOOLS}\winpty${BIT}.dll @@ -367,6 +366,8 @@ Section "$(str_section_exe)" id_section_exe File ${VIMRT}\colors\*.* SetOutPath $0\colors\tools File ${VIMRT}\colors\tools\*.* + SetOutPath $0\colors\lists + File ${VIMRT}\colors\lists\*.* SetOutPath $0\compiler File ${VIMRT}\compiler\*.* diff --git a/runtime/colors/README.txt b/runtime/colors/README.txt index 89501e0517..2b3471e398 100644 --- a/runtime/colors/README.txt +++ b/runtime/colors/README.txt @@ -87,4 +87,5 @@ please check the following items: - In the GUI, is it easy to find the cursor, also in a file with lots of syntax highlighting? - Do not use hard coded escape sequences, these will not work in other - terminals. Always use color names or #RRGGBB for the GUI. + terminals. Always use color names or #RRGGBB for the GUI. See v:colornames + for details on how to define your own color names. diff --git a/runtime/colors/lists/csscolors.vim b/runtime/colors/lists/csscolors.vim new file mode 100644 index 0000000000..74955226c2 --- /dev/null +++ b/runtime/colors/lists/csscolors.vim @@ -0,0 +1,166 @@ +" Maintainer: Drew Vogel +" Last Change: 2021 Jul 25 + +" Similar in spirit to rgb.txt, this plugin establishes a human-friendly name +" for every color listed in the CSS standard: +" +" https://www.w3.org/TR/css-color-3/ + +let s:keepcpo= &cpo +set cpo&vim + +call extend(v:colornames, { + \ 'css_black': '#000000', + \ 'css_silver': '#c0c0c0', + \ 'css_gray': '#808080', + \ 'css_white': '#FFFFFF', + \ 'css_maroon': '#800000', + \ 'css_red': '#FF0000', + \ 'css_purple': '#800080', + \ 'css_fuchsia': '#FF00FF', + \ 'css_green': '#008000', + \ 'css_lime': '#00FF00', + \ 'css_olive': '#808000', + \ 'css_yellow': '#FFFF00', + \ 'css_navy': '#000080', + \ 'css_blue': '#0000FF', + \ 'css_teal': '#008080', + \ 'css_aqua': '#00FFFF', + \ + \ 'css_aliceblue': '#f0f8ff', + \ 'css_antiquewhite': '#faebd7', + \ 'css_aquamarine': '#7fffd4', + \ 'css_azure': '#f0ffff', + \ 'css_beige': '#f5f5dc', + \ 'css_bisque': '#ffe4c4', + \ 'css_blanchedalmond': '#ffebcd', + \ 'css_blueviolet': '#8a2be2', + \ 'css_brown': '#a52a2a', + \ 'css_burlywood': '#deb887', + \ 'css_cadetblue': '#5f9ea0', + \ 'css_chartreuse': '#7fff00', + \ 'css_chocolate': '#d2691e', + \ 'css_coral': '#ff7f50', + \ 'css_cornflowerblue': '#6495ed', + \ 'css_cornsilk': '#fff8dc', + \ 'css_crimson': '#dc143c', + \ 'css_cyan': '#00ffff', + \ 'css_darkblue': '#00008b', + \ 'css_darkcyan': '#008b8b', + \ 'css_darkgoldenrod': '#b8860b', + \ 'css_darkgray': '#a9a9a9', + \ 'css_darkgreen': '#006400', + \ 'css_darkgrey': '#a9a9a9', + \ 'css_darkkhaki': '#bdb76b', + \ 'css_darkmagenta': '#8b008b', + \ 'css_darkolivegreen': '#556b2f', + \ 'css_darkorange': '#ff8c00', + \ 'css_darkorchid': '#9932cc', + \ 'css_darkred': '#8b0000', + \ 'css_darksalmon': '#e9967a', + \ 'css_darkseagreen': '#8fbc8f', + \ 'css_darkslateblue': '#483d8b', + \ 'css_darkslategray': '#2f4f4f', + \ 'css_darkslategrey': '#2f4f4f', + \ 'css_darkturquoise': '#00ced1', + \ 'css_darkviolet': '#9400d3', + \ 'css_deeppink': '#ff1493', + \ 'css_deepskyblue': '#00bfff', + \ 'css_dimgray': '#696969', + \ 'css_dimgrey': '#696969', + \ 'css_dodgerblue': '#1e90ff', + \ 'css_firebrick': '#b22222', + \ 'css_floralwhite': '#fffaf0', + \ 'css_forestgreen': '#228b22', + \ 'css_gainsboro': '#dcdcdc', + \ 'css_ghostwhite': '#f8f8ff', + \ 'css_gold': '#ffd700', + \ 'css_goldenrod': '#daa520', + \ 'css_greenyellow': '#adff2f', + \ 'css_grey': '#808080', + \ 'css_honeydew': '#f0fff0', + \ 'css_hotpink': '#ff69b4', + \ 'css_indianred': '#cd5c5c', + \ 'css_indigo': '#4b0082', + \ 'css_ivory': '#fffff0', + \ 'css_khaki': '#f0e68c', + \ 'css_lavender': '#e6e6fa', + \ 'css_lavenderblush': '#fff0f5', + \ 'css_lawngreen': '#7cfc00', + \ 'css_lemonchiffon': '#fffacd', + \ 'css_lightblue': '#add8e6', + \ 'css_lightcoral': '#f08080', + \ 'css_lightcyan': '#e0ffff', + \ 'css_lightgoldenrodyellow': '#fafad2', + \ 'css_lightgray': '#d3d3d3', + \ 'css_lightgreen': '#90ee90', + \ 'css_lightgrey': '#d3d3d3', + \ 'css_lightpink': '#ffb6c1', + \ 'css_lightsalmon': '#ffa07a', + \ 'css_lightseagreen': '#20b2aa', + \ 'css_lightskyblue': '#87cefa', + \ 'css_lightslategray': '#778899', + \ 'css_lightslategrey': '#778899', + \ 'css_lightsteelblue': '#b0c4de', + \ 'css_lightyellow': '#ffffe0', + \ 'css_limegreen': '#32cd32', + \ 'css_linen': '#faf0e6', + \ 'css_magenta': '#ff00ff', + \ 'css_mediumaquamarine': '#66cdaa', + \ 'css_mediumblue': '#0000cd', + \ 'css_mediumorchid': '#ba55d3', + \ 'css_mediumpurple': '#9370db', + \ 'css_mediumseagreen': '#3cb371', + \ 'css_mediumslateblue': '#7b68ee', + \ 'css_mediumspringgreen': '#00fa9a', + \ 'css_mediumturquoise': '#48d1cc', + \ 'css_mediumvioletred': '#c71585', + \ 'css_midnightblue': '#191970', + \ 'css_mintcream': '#f5fffa', + \ 'css_mistyrose': '#ffe4e1', + \ 'css_moccasin': '#ffe4b5', + \ 'css_navajowhite': '#ffdead', + \ 'css_oldlace': '#fdf5e6', + \ 'css_olivedrab': '#6b8e23', + \ 'css_orange': '#ffa500', + \ 'css_orangered': '#ff4500', + \ 'css_orchid': '#da70d6', + \ 'css_palegoldenrod': '#eee8aa', + \ 'css_palegreen': '#98fb98', + \ 'css_paleturquoise': '#afeeee', + \ 'css_palevioletred': '#db7093', + \ 'css_papayawhip': '#ffefd5', + \ 'css_peachpuff': '#ffdab9', + \ 'css_peru': '#cd853f', + \ 'css_pink': '#ffc0cb', + \ 'css_plum': '#dda0dd', + \ 'css_powderblue': '#b0e0e6', + \ 'css_rosybrown': '#bc8f8f', + \ 'css_royalblue': '#4169e1', + \ 'css_saddlebrown': '#8b4513', + \ 'css_salmon': '#fa8072', + \ 'css_sandybrown': '#f4a460', + \ 'css_seagreen': '#2e8b57', + \ 'css_seashell': '#fff5ee', + \ 'css_sienna': '#a0522d', + \ 'css_skyblue': '#87ceeb', + \ 'css_slateblue': '#6a5acd', + \ 'css_slategray': '#708090', + \ 'css_slategrey': '#708090', + \ 'css_snow': '#fffafa', + \ 'css_springgreen': '#00ff7f', + \ 'css_steelblue': '#4682b4', + \ 'css_tan': '#d2b48c', + \ 'css_thistle': '#d8bfd8', + \ 'css_tomato': '#ff6347', + \ 'css_turquoise': '#40e0d0', + \ 'css_violet': '#ee82ee', + \ 'css_wheat': '#f5deb3', + \ 'css_whitesmoke': '#f5f5f5', + \ 'css_yellowgreen': '#9acd32', + \ }, 'keep') + +let &cpo= s:keepcpo +unlet s:keepcpo + +"vim: sw=4 diff --git a/runtime/colors/lists/default.vim b/runtime/colors/lists/default.vim new file mode 100644 index 0000000000..5940048129 --- /dev/null +++ b/runtime/colors/lists/default.vim @@ -0,0 +1,801 @@ +" Maintainer: Drew Vogel +" Last Change: 2021 Jul 25 +" +" Replaced rgb.txt as the source of de facto standard color names. This is +" sourced each time the colorscheme command is run. It is also sourced each +" time the highlight command fails to recognize a gui color. You can override +" these colors by introducing a new colors/lists/default.vim file earlier in +" the runtimepath. + +let s:keepcpo= &cpo +set cpo&vim + +call extend(v:colornames, { + \ 'snow': '#fffafa', + \ 'ghost white': '#f8f8ff', + \ 'ghostwhite': '#f8f8ff', + \ 'white smoke': '#f5f5f5', + \ 'whitesmoke': '#f5f5f5', + \ 'gainsboro': '#dcdcdc', + \ 'floral white': '#fffaf0', + \ 'floralwhite': '#fffaf0', + \ 'old lace': '#fdf5e6', + \ 'oldlace': '#fdf5e6', + \ 'linen': '#faf0e6', + \ 'antique white': '#faebd7', + \ 'antiquewhite': '#faebd7', + \ 'papaya whip': '#ffefd5', + \ 'papayawhip': '#ffefd5', + \ 'blanched almond': '#ffebcd', + \ 'blanchedalmond': '#ffebcd', + \ 'bisque': '#ffe4c4', + \ 'peach puff': '#ffdab9', + \ 'peachpuff': '#ffdab9', + \ 'navajo white': '#ffdead', + \ 'navajowhite': '#ffdead', + \ 'moccasin': '#ffe4b5', + \ 'cornsilk': '#fff8dc', + \ 'ivory': '#fffff0', + \ 'lemon chiffon': '#fffacd', + \ 'lemonchiffon': '#fffacd', + \ 'seashell': '#fff5ee', + \ 'honeydew': '#f0fff0', + \ 'mint cream': '#f5fffa', + \ 'mintcream': '#f5fffa', + \ 'azure': '#f0ffff', + \ 'alice blue': '#f0f8ff', + \ 'aliceblue': '#f0f8ff', + \ 'lavender': '#e6e6fa', + \ 'lavender blush': '#fff0f5', + \ 'lavenderblush': '#fff0f5', + \ 'misty rose': '#ffe4e1', + \ 'mistyrose': '#ffe4e1', + \ 'white': '#ffffff', + \ 'black': '#000000', + \ 'dark slate gray': '#2f4f4f', + \ 'darkslategray': '#2f4f4f', + \ 'dark slate grey': '#2f4f4f', + \ 'darkslategrey': '#2f4f4f', + \ 'dim gray': '#696969', + \ 'dimgray': '#696969', + \ 'dim grey': '#696969', + \ 'dimgrey': '#696969', + \ 'slate gray': '#708090', + \ 'slategray': '#708090', + \ 'slate grey': '#708090', + \ 'slategrey': '#708090', + \ 'light slate gray': '#778899', + \ 'lightslategray': '#778899', + \ 'light slate grey': '#778899', + \ 'lightslategrey': '#778899', + \ 'gray': '#bebebe', + \ 'grey': '#bebebe', + \ 'x11 gray': '#bebebe', + \ 'x11gray': '#bebebe', + \ 'x11 grey': '#bebebe', + \ 'x11grey': '#bebebe', + \ 'web gray': '#808080', + \ 'webgray': '#808080', + \ 'web grey': '#808080', + \ 'webgrey': '#808080', + \ 'light grey': '#d3d3d3', + \ 'lightgrey': '#d3d3d3', + \ 'light gray': '#d3d3d3', + \ 'lightgray': '#d3d3d3', + \ 'midnight blue': '#191970', + \ 'midnightblue': '#191970', + \ 'navy': '#000080', + \ 'navy blue': '#000080', + \ 'navyblue': '#000080', + \ 'cornflower blue': '#6495ed', + \ 'cornflowerblue': '#6495ed', + \ 'dark slate blue': '#483d8b', + \ 'darkslateblue': '#483d8b', + \ 'slate blue': '#6a5acd', + \ 'slateblue': '#6a5acd', + \ 'medium slate blue': '#7b68ee', + \ 'mediumslateblue': '#7b68ee', + \ 'light slate blue': '#8470ff', + \ 'lightslateblue': '#8470ff', + \ 'medium blue': '#0000cd', + \ 'mediumblue': '#0000cd', + \ 'royal blue': '#4169e1', + \ 'royalblue': '#4169e1', + \ 'blue': '#0000ff', + \ 'dodger blue': '#1e90ff', + \ 'dodgerblue': '#1e90ff', + \ 'deep sky blue': '#00bfff', + \ 'deepskyblue': '#00bfff', + \ 'sky blue': '#87ceeb', + \ 'skyblue': '#87ceeb', + \ 'light sky blue': '#87cefa', + \ 'lightskyblue': '#87cefa', + \ 'steel blue': '#4682b4', + \ 'steelblue': '#4682b4', + \ 'light steel blue': '#b0c4de', + \ 'lightsteelblue': '#b0c4de', + \ 'light blue': '#add8e6', + \ 'lightblue': '#add8e6', + \ 'powder blue': '#b0e0e6', + \ 'powderblue': '#b0e0e6', + \ 'pale turquoise': '#afeeee', + \ 'paleturquoise': '#afeeee', + \ 'dark turquoise': '#00ced1', + \ 'darkturquoise': '#00ced1', + \ 'medium turquoise': '#48d1cc', + \ 'mediumturquoise': '#48d1cc', + \ 'turquoise': '#40e0d0', + \ 'cyan': '#00ffff', + \ 'aqua': '#00ffff', + \ 'light cyan': '#e0ffff', + \ 'lightcyan': '#e0ffff', + \ 'cadet blue': '#5f9ea0', + \ 'cadetblue': '#5f9ea0', + \ 'medium aquamarine': '#66cdaa', + \ 'mediumaquamarine': '#66cdaa', + \ 'aquamarine': '#7fffd4', + \ 'dark green': '#006400', + \ 'darkgreen': '#006400', + \ 'dark olive green': '#556b2f', + \ 'darkolivegreen': '#556b2f', + \ 'dark sea green': '#8fbc8f', + \ 'darkseagreen': '#8fbc8f', + \ 'sea green': '#2e8b57', + \ 'seagreen': '#2e8b57', + \ 'medium sea green': '#3cb371', + \ 'mediumseagreen': '#3cb371', + \ 'light sea green': '#20b2aa', + \ 'lightseagreen': '#20b2aa', + \ 'pale green': '#98fb98', + \ 'palegreen': '#98fb98', + \ 'spring green': '#00ff7f', + \ 'springgreen': '#00ff7f', + \ 'lawn green': '#7cfc00', + \ 'lawngreen': '#7cfc00', + \ 'green': '#00ff00', + \ 'lime': '#00ff00', + \ 'x11 green': '#00ff00', + \ 'x11green': '#00ff00', + \ 'web green': '#008000', + \ 'webgreen': '#008000', + \ 'chartreuse': '#7fff00', + \ 'medium spring green': '#00fa9a', + \ 'mediumspringgreen': '#00fa9a', + \ 'green yellow': '#adff2f', + \ 'greenyellow': '#adff2f', + \ 'lime green': '#32cd32', + \ 'limegreen': '#32cd32', + \ 'yellow green': '#9acd32', + \ 'yellowgreen': '#9acd32', + \ 'forest green': '#228b22', + \ 'forestgreen': '#228b22', + \ 'olive drab': '#6b8e23', + \ 'olivedrab': '#6b8e23', + \ 'dark khaki': '#bdb76b', + \ 'darkkhaki': '#bdb76b', + \ 'khaki': '#f0e68c', + \ 'pale goldenrod': '#eee8aa', + \ 'palegoldenrod': '#eee8aa', + \ 'light goldenrod yellow': '#fafad2', + \ 'lightgoldenrodyellow': '#fafad2', + \ 'light yellow': '#ffffe0', + \ 'lightyellow': '#ffffe0', + \ 'yellow': '#ffff00', + \ 'gold': '#ffd700', + \ 'light goldenrod': '#eedd82', + \ 'lightgoldenrod': '#eedd82', + \ 'goldenrod': '#daa520', + \ 'dark goldenrod': '#b8860b', + \ 'darkgoldenrod': '#b8860b', + \ 'rosy brown': '#bc8f8f', + \ 'rosybrown': '#bc8f8f', + \ 'indian red': '#cd5c5c', + \ 'indianred': '#cd5c5c', + \ 'saddle brown': '#8b4513', + \ 'saddlebrown': '#8b4513', + \ 'sienna': '#a0522d', + \ 'peru': '#cd853f', + \ 'burlywood': '#deb887', + \ 'beige': '#f5f5dc', + \ 'wheat': '#f5deb3', + \ 'sandy brown': '#f4a460', + \ 'sandybrown': '#f4a460', + \ 'tan': '#d2b48c', + \ 'chocolate': '#d2691e', + \ 'firebrick': '#b22222', + \ 'brown': '#a52a2a', + \ 'dark salmon': '#e9967a', + \ 'darksalmon': '#e9967a', + \ 'salmon': '#fa8072', + \ 'light salmon': '#ffa07a', + \ 'lightsalmon': '#ffa07a', + \ 'orange': '#ffa500', + \ 'dark orange': '#ff8c00', + \ 'darkorange': '#ff8c00', + \ 'coral': '#ff7f50', + \ 'light coral': '#f08080', + \ 'lightcoral': '#f08080', + \ 'tomato': '#ff6347', + \ 'orange red': '#ff4500', + \ 'orangered': '#ff4500', + \ 'red': '#ff0000', + \ 'hot pink': '#ff69b4', + \ 'hotpink': '#ff69b4', + \ 'deep pink': '#ff1493', + \ 'deeppink': '#ff1493', + \ 'pink': '#ffc0cb', + \ 'light pink': '#ffb6c1', + \ 'lightpink': '#ffb6c1', + \ 'pale violet red': '#db7093', + \ 'palevioletred': '#db7093', + \ 'maroon': '#b03060', + \ 'x11 maroon': '#b03060', + \ 'x11maroon': '#b03060', + \ 'web maroon': '#800000', + \ 'webmaroon': '#800000', + \ 'medium violet red': '#c71585', + \ 'mediumvioletred': '#c71585', + \ 'violet red': '#d02090', + \ 'violetred': '#d02090', + \ 'magenta': '#ff00ff', + \ 'fuchsia': '#ff00ff', + \ 'violet': '#ee82ee', + \ 'plum': '#dda0dd', + \ 'orchid': '#da70d6', + \ 'medium orchid': '#ba55d3', + \ 'mediumorchid': '#ba55d3', + \ 'dark orchid': '#9932cc', + \ 'darkorchid': '#9932cc', + \ 'dark violet': '#9400d3', + \ 'darkviolet': '#9400d3', + \ 'blue violet': '#8a2be2', + \ 'blueviolet': '#8a2be2', + \ 'purple': '#a020f0', + \ 'x11 purple': '#a020f0', + \ 'x11purple': '#a020f0', + \ 'web purple': '#800080', + \ 'webpurple': '#800080', + \ 'medium purple': '#9370db', + \ 'mediumpurple': '#9370db', + \ 'thistle': '#d8bfd8', + \ 'snow1': '#fffafa', + \ 'snow2': '#eee9e9', + \ 'snow3': '#cdc9c9', + \ 'snow4': '#8b8989', + \ 'seashell1': '#fff5ee', + \ 'seashell2': '#eee5de', + \ 'seashell3': '#cdc5bf', + \ 'seashell4': '#8b8682', + \ 'antiquewhite1': '#ffefdb', + \ 'antiquewhite2': '#eedfcc', + \ 'antiquewhite3': '#cdc0b0', + \ 'antiquewhite4': '#8b8378', + \ 'bisque1': '#ffe4c4', + \ 'bisque2': '#eed5b7', + \ 'bisque3': '#cdb79e', + \ 'bisque4': '#8b7d6b', + \ 'peachpuff1': '#ffdab9', + \ 'peachpuff2': '#eecbad', + \ 'peachpuff3': '#cdaf95', + \ 'peachpuff4': '#8b7765', + \ 'navajowhite1': '#ffdead', + \ 'navajowhite2': '#eecfa1', + \ 'navajowhite3': '#cdb38b', + \ 'navajowhite4': '#8b795e', + \ 'lemonchiffon1': '#fffacd', + \ 'lemonchiffon2': '#eee9bf', + \ 'lemonchiffon3': '#cdc9a5', + \ 'lemonchiffon4': '#8b8970', + \ 'cornsilk1': '#fff8dc', + \ 'cornsilk2': '#eee8cd', + \ 'cornsilk3': '#cdc8b1', + \ 'cornsilk4': '#8b8878', + \ 'ivory1': '#fffff0', + \ 'ivory2': '#eeeee0', + \ 'ivory3': '#cdcdc1', + \ 'ivory4': '#8b8b83', + \ 'honeydew1': '#f0fff0', + \ 'honeydew2': '#e0eee0', + \ 'honeydew3': '#c1cdc1', + \ 'honeydew4': '#838b83', + \ 'lavenderblush1': '#fff0f5', + \ 'lavenderblush2': '#eee0e5', + \ 'lavenderblush3': '#cdc1c5', + \ 'lavenderblush4': '#8b8386', + \ 'mistyrose1': '#ffe4e1', + \ 'mistyrose2': '#eed5d2', + \ 'mistyrose3': '#cdb7b5', + \ 'mistyrose4': '#8b7d7b', + \ 'azure1': '#f0ffff', + \ 'azure2': '#e0eeee', + \ 'azure3': '#c1cdcd', + \ 'azure4': '#838b8b', + \ 'slateblue1': '#836fff', + \ 'slateblue2': '#7a67ee', + \ 'slateblue3': '#6959cd', + \ 'slateblue4': '#473c8b', + \ 'royalblue1': '#4876ff', + \ 'royalblue2': '#436eee', + \ 'royalblue3': '#3a5fcd', + \ 'royalblue4': '#27408b', + \ 'blue1': '#0000ff', + \ 'blue2': '#0000ee', + \ 'blue3': '#0000cd', + \ 'blue4': '#00008b', + \ 'dodgerblue1': '#1e90ff', + \ 'dodgerblue2': '#1c86ee', + \ 'dodgerblue3': '#1874cd', + \ 'dodgerblue4': '#104e8b', + \ 'steelblue1': '#63b8ff', + \ 'steelblue2': '#5cacee', + \ 'steelblue3': '#4f94cd', + \ 'steelblue4': '#36648b', + \ 'deepskyblue1': '#00bfff', + \ 'deepskyblue2': '#00b2ee', + \ 'deepskyblue3': '#009acd', + \ 'deepskyblue4': '#00688b', + \ 'skyblue1': '#87ceff', + \ 'skyblue2': '#7ec0ee', + \ 'skyblue3': '#6ca6cd', + \ 'skyblue4': '#4a708b', + \ 'lightskyblue1': '#b0e2ff', + \ 'lightskyblue2': '#a4d3ee', + \ 'lightskyblue3': '#8db6cd', + \ 'lightskyblue4': '#607b8b', + \ 'slategray1': '#c6e2ff', + \ 'slategray2': '#b9d3ee', + \ 'slategray3': '#9fb6cd', + \ 'slategray4': '#6c7b8b', + \ 'lightsteelblue1': '#cae1ff', + \ 'lightsteelblue2': '#bcd2ee', + \ 'lightsteelblue3': '#a2b5cd', + \ 'lightsteelblue4': '#6e7b8b', + \ 'lightblue1': '#bfefff', + \ 'lightblue2': '#b2dfee', + \ 'lightblue3': '#9ac0cd', + \ 'lightblue4': '#68838b', + \ 'lightcyan1': '#e0ffff', + \ 'lightcyan2': '#d1eeee', + \ 'lightcyan3': '#b4cdcd', + \ 'lightcyan4': '#7a8b8b', + \ 'paleturquoise1': '#bbffff', + \ 'paleturquoise2': '#aeeeee', + \ 'paleturquoise3': '#96cdcd', + \ 'paleturquoise4': '#668b8b', + \ 'cadetblue1': '#98f5ff', + \ 'cadetblue2': '#8ee5ee', + \ 'cadetblue3': '#7ac5cd', + \ 'cadetblue4': '#53868b', + \ 'turquoise1': '#00f5ff', + \ 'turquoise2': '#00e5ee', + \ 'turquoise3': '#00c5cd', + \ 'turquoise4': '#00868b', + \ 'cyan1': '#00ffff', + \ 'cyan2': '#00eeee', + \ 'cyan3': '#00cdcd', + \ 'cyan4': '#008b8b', + \ 'darkslategray1': '#97ffff', + \ 'darkslategray2': '#8deeee', + \ 'darkslategray3': '#79cdcd', + \ 'darkslategray4': '#528b8b', + \ 'aquamarine1': '#7fffd4', + \ 'aquamarine2': '#76eec6', + \ 'aquamarine3': '#66cdaa', + \ 'aquamarine4': '#458b74', + \ 'darkseagreen1': '#c1ffc1', + \ 'darkseagreen2': '#b4eeb4', + \ 'darkseagreen3': '#9bcd9b', + \ 'darkseagreen4': '#698b69', + \ 'seagreen1': '#54ff9f', + \ 'seagreen2': '#4eee94', + \ 'seagreen3': '#43cd80', + \ 'seagreen4': '#2e8b57', + \ 'palegreen1': '#9aff9a', + \ 'palegreen2': '#90ee90', + \ 'palegreen3': '#7ccd7c', + \ 'palegreen4': '#548b54', + \ 'springgreen1': '#00ff7f', + \ 'springgreen2': '#00ee76', + \ 'springgreen3': '#00cd66', + \ 'springgreen4': '#008b45', + \ 'green1': '#00ff00', + \ 'green2': '#00ee00', + \ 'green3': '#00cd00', + \ 'green4': '#008b00', + \ 'chartreuse1': '#7fff00', + \ 'chartreuse2': '#76ee00', + \ 'chartreuse3': '#66cd00', + \ 'chartreuse4': '#458b00', + \ 'olivedrab1': '#c0ff3e', + \ 'olivedrab2': '#b3ee3a', + \ 'olivedrab3': '#9acd32', + \ 'olivedrab4': '#698b22', + \ 'darkolivegreen1': '#caff70', + \ 'darkolivegreen2': '#bcee68', + \ 'darkolivegreen3': '#a2cd5a', + \ 'darkolivegreen4': '#6e8b3d', + \ 'khaki1': '#fff68f', + \ 'khaki2': '#eee685', + \ 'khaki3': '#cdc673', + \ 'khaki4': '#8b864e', + \ 'lightgoldenrod1': '#ffec8b', + \ 'lightgoldenrod2': '#eedc82', + \ 'lightgoldenrod3': '#cdbe70', + \ 'lightgoldenrod4': '#8b814c', + \ 'lightyellow1': '#ffffe0', + \ 'lightyellow2': '#eeeed1', + \ 'lightyellow3': '#cdcdb4', + \ 'lightyellow4': '#8b8b7a', + \ 'yellow1': '#ffff00', + \ 'yellow2': '#eeee00', + \ 'yellow3': '#cdcd00', + \ 'yellow4': '#8b8b00', + \ 'gold1': '#ffd700', + \ 'gold2': '#eec900', + \ 'gold3': '#cdad00', + \ 'gold4': '#8b7500', + \ 'goldenrod1': '#ffc125', + \ 'goldenrod2': '#eeb422', + \ 'goldenrod3': '#cd9b1d', + \ 'goldenrod4': '#8b6914', + \ 'darkgoldenrod1': '#ffb90f', + \ 'darkgoldenrod2': '#eead0e', + \ 'darkgoldenrod3': '#cd950c', + \ 'darkgoldenrod4': '#8b6508', + \ 'rosybrown1': '#ffc1c1', + \ 'rosybrown2': '#eeb4b4', + \ 'rosybrown3': '#cd9b9b', + \ 'rosybrown4': '#8b6969', + \ 'indianred1': '#ff6a6a', + \ 'indianred2': '#ee6363', + \ 'indianred3': '#cd5555', + \ 'indianred4': '#8b3a3a', + \ 'sienna1': '#ff8247', + \ 'sienna2': '#ee7942', + \ 'sienna3': '#cd6839', + \ 'sienna4': '#8b4726', + \ 'burlywood1': '#ffd39b', + \ 'burlywood2': '#eec591', + \ 'burlywood3': '#cdaa7d', + \ 'burlywood4': '#8b7355', + \ 'wheat1': '#ffe7ba', + \ 'wheat2': '#eed8ae', + \ 'wheat3': '#cdba96', + \ 'wheat4': '#8b7e66', + \ 'tan1': '#ffa54f', + \ 'tan2': '#ee9a49', + \ 'tan3': '#cd853f', + \ 'tan4': '#8b5a2b', + \ 'chocolate1': '#ff7f24', + \ 'chocolate2': '#ee7621', + \ 'chocolate3': '#cd661d', + \ 'chocolate4': '#8b4513', + \ 'firebrick1': '#ff3030', + \ 'firebrick2': '#ee2c2c', + \ 'firebrick3': '#cd2626', + \ 'firebrick4': '#8b1a1a', + \ 'brown1': '#ff4040', + \ 'brown2': '#ee3b3b', + \ 'brown3': '#cd3333', + \ 'brown4': '#8b2323', + \ 'salmon1': '#ff8c69', + \ 'salmon2': '#ee8262', + \ 'salmon3': '#cd7054', + \ 'salmon4': '#8b4c39', + \ 'lightsalmon1': '#ffa07a', + \ 'lightsalmon2': '#ee9572', + \ 'lightsalmon3': '#cd8162', + \ 'lightsalmon4': '#8b5742', + \ 'orange1': '#ffa500', + \ 'orange2': '#ee9a00', + \ 'orange3': '#cd8500', + \ 'orange4': '#8b5a00', + \ 'darkorange1': '#ff7f00', + \ 'darkorange2': '#ee7600', + \ 'darkorange3': '#cd6600', + \ 'darkorange4': '#8b4500', + \ 'coral1': '#ff7256', + \ 'coral2': '#ee6a50', + \ 'coral3': '#cd5b45', + \ 'coral4': '#8b3e2f', + \ 'tomato1': '#ff6347', + \ 'tomato2': '#ee5c42', + \ 'tomato3': '#cd4f39', + \ 'tomato4': '#8b3626', + \ 'orangered1': '#ff4500', + \ 'orangered2': '#ee4000', + \ 'orangered3': '#cd3700', + \ 'orangered4': '#8b2500', + \ 'red1': '#ff0000', + \ 'red2': '#ee0000', + \ 'red3': '#cd0000', + \ 'red4': '#8b0000', + \ 'deeppink1': '#ff1493', + \ 'deeppink2': '#ee1289', + \ 'deeppink3': '#cd1076', + \ 'deeppink4': '#8b0a50', + \ 'hotpink1': '#ff6eb4', + \ 'hotpink2': '#ee6aa7', + \ 'hotpink3': '#cd6090', + \ 'hotpink4': '#8b3a62', + \ 'pink1': '#ffb5c5', + \ 'pink2': '#eea9b8', + \ 'pink3': '#cd919e', + \ 'pink4': '#8b636c', + \ 'lightpink1': '#ffaeb9', + \ 'lightpink2': '#eea2ad', + \ 'lightpink3': '#cd8c95', + \ 'lightpink4': '#8b5f65', + \ 'palevioletred1': '#ff82ab', + \ 'palevioletred2': '#ee799f', + \ 'palevioletred3': '#cd6889', + \ 'palevioletred4': '#8b475d', + \ 'maroon1': '#ff34b3', + \ 'maroon2': '#ee30a7', + \ 'maroon3': '#cd2990', + \ 'maroon4': '#8b1c62', + \ 'violetred1': '#ff3e96', + \ 'violetred2': '#ee3a8c', + \ 'violetred3': '#cd3278', + \ 'violetred4': '#8b2252', + \ 'magenta1': '#ff00ff', + \ 'magenta2': '#ee00ee', + \ 'magenta3': '#cd00cd', + \ 'magenta4': '#8b008b', + \ 'orchid1': '#ff83fa', + \ 'orchid2': '#ee7ae9', + \ 'orchid3': '#cd69c9', + \ 'orchid4': '#8b4789', + \ 'plum1': '#ffbbff', + \ 'plum2': '#eeaeee', + \ 'plum3': '#cd96cd', + \ 'plum4': '#8b668b', + \ 'mediumorchid1': '#e066ff', + \ 'mediumorchid2': '#d15fee', + \ 'mediumorchid3': '#b452cd', + \ 'mediumorchid4': '#7a378b', + \ 'darkorchid1': '#bf3eff', + \ 'darkorchid2': '#b23aee', + \ 'darkorchid3': '#9a32cd', + \ 'darkorchid4': '#68228b', + \ 'purple1': '#9b30ff', + \ 'purple2': '#912cee', + \ 'purple3': '#7d26cd', + \ 'purple4': '#551a8b', + \ 'mediumpurple1': '#ab82ff', + \ 'mediumpurple2': '#9f79ee', + \ 'mediumpurple3': '#8968cd', + \ 'mediumpurple4': '#5d478b', + \ 'thistle1': '#ffe1ff', + \ 'thistle2': '#eed2ee', + \ 'thistle3': '#cdb5cd', + \ 'thistle4': '#8b7b8b', + \ 'gray0': '#000000', + \ 'grey0': '#000000', + \ 'gray1': '#030303', + \ 'grey1': '#030303', + \ 'gray2': '#050505', + \ 'grey2': '#050505', + \ 'gray3': '#080808', + \ 'grey3': '#080808', + \ 'gray4': '#0a0a0a', + \ 'grey4': '#0a0a0a', + \ 'gray5': '#0d0d0d', + \ 'grey5': '#0d0d0d', + \ 'gray6': '#0f0f0f', + \ 'grey6': '#0f0f0f', + \ 'gray7': '#121212', + \ 'grey7': '#121212', + \ 'gray8': '#141414', + \ 'grey8': '#141414', + \ 'gray9': '#171717', + \ 'grey9': '#171717', + \ 'gray10': '#1a1a1a', + \ 'grey10': '#1a1a1a', + \ 'gray11': '#1c1c1c', + \ 'grey11': '#1c1c1c', + \ 'gray12': '#1f1f1f', + \ 'grey12': '#1f1f1f', + \ 'gray13': '#212121', + \ 'grey13': '#212121', + \ 'gray14': '#242424', + \ 'grey14': '#242424', + \ 'gray15': '#262626', + \ 'grey15': '#262626', + \ 'gray16': '#292929', + \ 'grey16': '#292929', + \ 'gray17': '#2b2b2b', + \ 'grey17': '#2b2b2b', + \ 'gray18': '#2e2e2e', + \ 'grey18': '#2e2e2e', + \ 'gray19': '#303030', + \ 'grey19': '#303030', + \ 'gray20': '#333333', + \ 'grey20': '#333333', + \ 'gray21': '#363636', + \ 'grey21': '#363636', + \ 'gray22': '#383838', + \ 'grey22': '#383838', + \ 'gray23': '#3b3b3b', + \ 'grey23': '#3b3b3b', + \ 'gray24': '#3d3d3d', + \ 'grey24': '#3d3d3d', + \ 'gray25': '#404040', + \ 'grey25': '#404040', + \ 'gray26': '#424242', + \ 'grey26': '#424242', + \ 'gray27': '#454545', + \ 'grey27': '#454545', + \ 'gray28': '#474747', + \ 'grey28': '#474747', + \ 'gray29': '#4a4a4a', + \ 'grey29': '#4a4a4a', + \ 'gray30': '#4d4d4d', + \ 'grey30': '#4d4d4d', + \ 'gray31': '#4f4f4f', + \ 'grey31': '#4f4f4f', + \ 'gray32': '#525252', + \ 'grey32': '#525252', + \ 'gray33': '#545454', + \ 'grey33': '#545454', + \ 'gray34': '#575757', + \ 'grey34': '#575757', + \ 'gray35': '#595959', + \ 'grey35': '#595959', + \ 'gray36': '#5c5c5c', + \ 'grey36': '#5c5c5c', + \ 'gray37': '#5e5e5e', + \ 'grey37': '#5e5e5e', + \ 'gray38': '#616161', + \ 'grey38': '#616161', + \ 'gray39': '#636363', + \ 'grey39': '#636363', + \ 'gray40': '#666666', + \ 'grey40': '#666666', + \ 'gray41': '#696969', + \ 'grey41': '#696969', + \ 'gray42': '#6b6b6b', + \ 'grey42': '#6b6b6b', + \ 'gray43': '#6e6e6e', + \ 'grey43': '#6e6e6e', + \ 'gray44': '#707070', + \ 'grey44': '#707070', + \ 'gray45': '#737373', + \ 'grey45': '#737373', + \ 'gray46': '#757575', + \ 'grey46': '#757575', + \ 'gray47': '#787878', + \ 'grey47': '#787878', + \ 'gray48': '#7a7a7a', + \ 'grey48': '#7a7a7a', + \ 'gray49': '#7d7d7d', + \ 'grey49': '#7d7d7d', + \ 'gray50': '#7f7f7f', + \ 'grey50': '#7f7f7f', + \ 'gray51': '#828282', + \ 'grey51': '#828282', + \ 'gray52': '#858585', + \ 'grey52': '#858585', + \ 'gray53': '#878787', + \ 'grey53': '#878787', + \ 'gray54': '#8a8a8a', + \ 'grey54': '#8a8a8a', + \ 'gray55': '#8c8c8c', + \ 'grey55': '#8c8c8c', + \ 'gray56': '#8f8f8f', + \ 'grey56': '#8f8f8f', + \ 'gray57': '#919191', + \ 'grey57': '#919191', + \ 'gray58': '#949494', + \ 'grey58': '#949494', + \ 'gray59': '#969696', + \ 'grey59': '#969696', + \ 'gray60': '#999999', + \ 'grey60': '#999999', + \ 'gray61': '#9c9c9c', + \ 'grey61': '#9c9c9c', + \ 'gray62': '#9e9e9e', + \ 'grey62': '#9e9e9e', + \ 'gray63': '#a1a1a1', + \ 'grey63': '#a1a1a1', + \ 'gray64': '#a3a3a3', + \ 'grey64': '#a3a3a3', + \ 'gray65': '#a6a6a6', + \ 'grey65': '#a6a6a6', + \ 'gray66': '#a8a8a8', + \ 'grey66': '#a8a8a8', + \ 'gray67': '#ababab', + \ 'grey67': '#ababab', + \ 'gray68': '#adadad', + \ 'grey68': '#adadad', + \ 'gray69': '#b0b0b0', + \ 'grey69': '#b0b0b0', + \ 'gray70': '#b3b3b3', + \ 'grey70': '#b3b3b3', + \ 'gray71': '#b5b5b5', + \ 'grey71': '#b5b5b5', + \ 'gray72': '#b8b8b8', + \ 'grey72': '#b8b8b8', + \ 'gray73': '#bababa', + \ 'grey73': '#bababa', + \ 'gray74': '#bdbdbd', + \ 'grey74': '#bdbdbd', + \ 'gray75': '#bfbfbf', + \ 'grey75': '#bfbfbf', + \ 'gray76': '#c2c2c2', + \ 'grey76': '#c2c2c2', + \ 'gray77': '#c4c4c4', + \ 'grey77': '#c4c4c4', + \ 'gray78': '#c7c7c7', + \ 'grey78': '#c7c7c7', + \ 'gray79': '#c9c9c9', + \ 'grey79': '#c9c9c9', + \ 'gray80': '#cccccc', + \ 'grey80': '#cccccc', + \ 'gray81': '#cfcfcf', + \ 'grey81': '#cfcfcf', + \ 'gray82': '#d1d1d1', + \ 'grey82': '#d1d1d1', + \ 'gray83': '#d4d4d4', + \ 'grey83': '#d4d4d4', + \ 'gray84': '#d6d6d6', + \ 'grey84': '#d6d6d6', + \ 'gray85': '#d9d9d9', + \ 'grey85': '#d9d9d9', + \ 'gray86': '#dbdbdb', + \ 'grey86': '#dbdbdb', + \ 'gray87': '#dedede', + \ 'grey87': '#dedede', + \ 'gray88': '#e0e0e0', + \ 'grey88': '#e0e0e0', + \ 'gray89': '#e3e3e3', + \ 'grey89': '#e3e3e3', + \ 'gray90': '#e5e5e5', + \ 'grey90': '#e5e5e5', + \ 'gray91': '#e8e8e8', + \ 'grey91': '#e8e8e8', + \ 'gray92': '#ebebeb', + \ 'grey92': '#ebebeb', + \ 'gray93': '#ededed', + \ 'grey93': '#ededed', + \ 'gray94': '#f0f0f0', + \ 'grey94': '#f0f0f0', + \ 'gray95': '#f2f2f2', + \ 'grey95': '#f2f2f2', + \ 'gray96': '#f5f5f5', + \ 'grey96': '#f5f5f5', + \ 'gray97': '#f7f7f7', + \ 'grey97': '#f7f7f7', + \ 'gray98': '#fafafa', + \ 'grey98': '#fafafa', + \ 'gray99': '#fcfcfc', + \ 'grey99': '#fcfcfc', + \ 'gray100': '#ffffff', + \ 'grey100': '#ffffff', + \ 'dark grey': '#a9a9a9', + \ 'darkgrey': '#a9a9a9', + \ 'dark gray': '#a9a9a9', + \ 'darkgray': '#a9a9a9', + \ 'dark blue': '#00008b', + \ 'darkblue': '#00008b', + \ 'dark cyan': '#008b8b', + \ 'darkcyan': '#008b8b', + \ 'dark magenta': '#8b008b', + \ 'darkmagenta': '#8b008b', + \ 'dark red': '#8b0000', + \ 'darkred': '#8b0000', + \ 'light green': '#90ee90', + \ 'lightgreen': '#90ee90', + \ 'crimson': '#dc143c', + \ 'indigo': '#4b0082', + \ 'olive': '#808000', + \ 'rebecca purple': '#663399', + \ 'rebeccapurple': '#663399', + \ 'silver': '#c0c0c0', + \ 'teal': '#008080' + \ }, 'keep') + +let &cpo= s:keepcpo +unlet s:keepcpo + +"vim: sw=4 diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 8d31483ec6..418aee9ceb 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1840,6 +1840,43 @@ v:collate The current locale setting for collation order of the runtime command. See |multi-lang|. + *v:colornames* +v:colornames A dictionary that maps color names to hex color strings. These + color names can be used with the |highlight-guifg|, + |highlight-guibg|, and |highlight-guisp| parameters. Updating + an entry in v:colornames has no immediate effect on the syntax + highlighting. The highlight commands (probably in a + colorscheme script) need to be re-evaluated in order to use + the updated color values. For example: > + + :let v:colornames['fuscia'] = '#cf3ab4' + :let v:colornames['mauve'] = '#915f6d' + :highlight Normal guifg=fuscia guibg=mauve +< + This cannot be used to override the |cterm-colors| but it can + be used to override other colors. For example, the X11 colors + defined in the `colors/lists/default.vim` (previously defined + in |rgb.txt|). When defining new color names in a plugin, the + recommended practice is to set a color entry only when it does + not already exist. For example: > + + :call extend(v:colornames, { + \ 'fuscia': '#cf3ab4', + \ 'mauve': '#915f6d, + \ }, 'keep') +< + Using |extend| with the 'keep' option updates each color only + if it did not exist in |v:colornames|. Doing so allows the + user to choose the precise color value for a common name + by setting it in their |.vimrc|. + + It is possible to remove entries from this dictionary but + doing so is *NOT* recommended. Doing so is disruptive to + other scripts. It is also unlikely to achieve the desired + result because the |colorscheme| and |highlight| commands will + both automatically load all `colors/lists/default.vim` color + scripts. + *v:completed_item* *completed_item-variable* v:completed_item |Dictionary| containing the |complete-items| for the most diff --git a/runtime/doc/gui_w32.txt b/runtime/doc/gui_w32.txt index b83df1b98b..227d0a271a 100644 --- a/runtime/doc/gui_w32.txt +++ b/runtime/doc/gui_w32.txt @@ -323,20 +323,10 @@ These extra colors are also available: Gray, Grey, LightYellow, SeaGreen, Orange, Purple, SlateBlue, Violet, *rgb.txt* -Additionally, colors defined by a "rgb.txt" file can be used. This file is -well known from X11. A few lines from it: > - - 255 218 185 peach puff - 205 133 63 peru - 255 181 197 pink - -This shows the layout of the file: First the R, G and B value as a decimal -number, followed by the name of the color. The four fields are separated by -spaces. - -You can get an rgb.txt file from any X11 distribution. It is located in a -directory like "/usr/X11R6/lib/X11/". For Vim it must be located in the -$VIMRUNTIME directory. Thus the file can be found with "$VIMRUNTIME/rgb.txt". +Additionally, colors defined by a default color list can be used. For more +info see |:colorscheme|. These colors used to be defined in +$VIMRUNTIME/rgb.txt, now they are in |v:colornames| which is initialized from +$VIMRUNTIME/colors/lists/default.vim. ============================================================================== *gui-w32-dialogs* *dialog* diff --git a/runtime/doc/message.txt b/runtime/doc/message.txt index 2dc7535468..5334ac00c0 100644 --- a/runtime/doc/message.txt +++ b/runtime/doc/message.txt @@ -141,6 +141,11 @@ larger. When it's more there probably is an endless loop. Probably a The color name {name} is unknown. See |gui-colors| for a list of colors that are available on most systems. + *E1244* > + Bad color string: {str} + +The provided color did not conform to the pattern #rrggbb + *E458* > Cannot allocate colormap entry, some colors may be incorrect diff --git a/runtime/doc/os_haiku.txt b/runtime/doc/os_haiku.txt index 5c520b0683..a22b99bf43 100644 --- a/runtime/doc/os_haiku.txt +++ b/runtime/doc/os_haiku.txt @@ -194,9 +194,8 @@ $VIM/macros/swapmous.vim for an example. |gui-mouse-mapping| 11. Color names *haiku-colors* -Vim has a number of color names built-in. Additional names are read from the -file $VIMRUNTIME/rgb.txt, if present. This file is basically the color -database from X. Names used from this file are cached for efficiency. +Vim has a number of color names built-in. Additional names can be defined in +|v:colornames|. See |:colorscheme| for details. 12. GUI Toolbar Images *haiku-toolbar-images* diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index 1ade9e99d9..1c20659acf 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -5143,8 +5143,35 @@ guisp={color-name} *highlight-guisp* "gg" is the Green value "bb" is the Blue value All values are hexadecimal, range from "00" to "ff". Examples: > - :highlight Comment guifg=#11f0c3 guibg=#ff00ff + :highlight Comment guifg=#11f0c3 guibg=#ff00ff < + If you are authoring a color scheme and use the same hexademical value + repeatedly, you can define a name for it in |v:colornames|. For + example: > + + # provide a default value for this color but allow the user to + # override it. + :call extend(v:colornames, {'alt_turquoise': '#11f0c3'}, 'keep') + :highlight Comment guifg=alt_turquoise guibg=magenta +< + If you are using a color scheme that relies on named colors and you + would like to adjust the precise appearance of those colors, you can + do so by overriding the values in |v:colornames| prior to loading the + scheme: > + + let v:colornames['alt_turquoise'] = '#22f0d3' + colorscheme alt +< + If you want to develop a color list that can be relied on by others, + it is best to prefix your color names. By convention these color lists + are placed in the colors/lists directory. You can see an example in + '$VIMRUNTIME/colors/lists/csscolors.vim'. This list would be sourced + by a color scheme using: > + + :runtime colors/lists/csscolors.vim + :highlight Comment guifg=css_turquoise +< + *highlight-groups* *highlight-default* These are the default highlighting groups. These groups are used by the 'highlight' option default. Note that the highlighting depends on the value diff --git a/runtime/doc/usr_06.txt b/runtime/doc/usr_06.txt index 65d69dec5c..2cf672e70c 100644 --- a/runtime/doc/usr_06.txt +++ b/runtime/doc/usr_06.txt @@ -184,7 +184,30 @@ this command: > :runtime syntax/colortest.vim You will see text in various color combinations. You can check which ones are -readable and look nice. +readable and look nice. These aren't the only colors available to you though. +You can specify #rrggbb hex colors and you can define new names for hex +colors in |v:colornames| like so: > + + let v:colornames['mine_red'] = '#aa0000' +< +If you are authoring a color scheme for others to use, it is important +to define these colors only when they do not exist: > + + call extend(v:colornames, {'mine_red': '#aa0000'}, 'keep') + +This allows users of the color scheme to override the precise definition of +that color prior to loading your color scheme. For example, in a |.vimrc| +file: + + runtime colors/lists/css_colors.vim + let v:colornames['your_red'] = v:colornames['css_red'] + colorscheme yourscheme + +As a color scheme author, you should be able to rely on some color names for +GUI colors. These are defined in `colors/lists/default.vim`. All such files +found on the |runtimepath| are loaded each time the colorscheme command is +run. A canonical list is provided by the vim distribution, which should +include all X11 colors (previously defined in rgb.txt). ============================================================================== *06.4* With colors or without colors diff --git a/src/Makefile b/src/Makefile index 32411d0b88..e5953afdbd 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1136,9 +1136,6 @@ SYS_DELMENU_FILE = $(DESTDIR)$(SCRIPTLOC)/delmenu.vim ### Name of the bugreport file target. SYS_BUGR_FILE = $(DESTDIR)$(SCRIPTLOC)/bugreport.vim -### Name of the rgb.txt file target. -SYS_RGB_FILE = $(DESTDIR)$(SCRIPTLOC)/rgb.txt - ### Name of the file type detection file target. SYS_FILETYPE_FILE = $(DESTDIR)$(SCRIPTLOC)/filetype.vim @@ -2449,9 +2446,6 @@ installrtbase: $(HELPSOURCE)/vim.1 $(DEST_VIM) $(DEST_RT) \ chmod $(VIMSCRIPTMOD) $(EVIM_FILE) $(INSTALL_DATA) $(SCRIPTSOURCE)/mswin.vim $(MSWIN_FILE) chmod $(VIMSCRIPTMOD) $(MSWIN_FILE) -# install the rgb.txt file - $(INSTALL_DATA) $(SCRIPTSOURCE)/rgb.txt $(SYS_RGB_FILE) - chmod $(VIMSCRIPTMOD) $(SYS_RGB_FILE) # install the bugreport file $(INSTALL_DATA) $(SCRIPTSOURCE)/bugreport.vim $(SYS_BUGR_FILE) chmod $(VIMSCRIPTMOD) $(SYS_BUGR_FILE) @@ -2481,7 +2475,7 @@ installrtbase: $(HELPSOURCE)/vim.1 $(DEST_VIM) $(DEST_RT) \ cd $(PRINTSOURCE); $(INSTALL_DATA) *.ps $(DEST_PRINT) cd $(DEST_PRINT); chmod $(FILEMOD) *.ps # install the colorscheme files - cd $(COLSOURCE); $(INSTALL_DATA_R) *.vim tools README.txt $(DEST_COL) + cd $(COLSOURCE); $(INSTALL_DATA_R) *.vim lists tools README.txt $(DEST_COL) cd $(DEST_COL); chmod $(DIRMOD) tools cd $(DEST_COL); chmod $(HELPMOD) *.vim README.txt tools/*.vim # install the syntax files @@ -2894,7 +2888,6 @@ uninstall_runtime: -rm -f $(DEST_MAN_RU)/xxd.1 $(DEST_MAN_RU_U)/xxd.1 -rm -f $(DEST_HELP)/*.txt $(DEST_HELP)/tags $(DEST_HELP)/*.pl -rm -f $(DEST_HELP)/*.??x $(DEST_HELP)/tags-?? - -rm -f $(SYS_RGB_FILE) -rm -f $(SYS_MENU_FILE) $(SYS_SYNMENU_FILE) $(SYS_DELMENU_FILE) -rm -f $(SYS_BUGR_FILE) $(VIM_DEFAULTS_FILE) $(EVIM_FILE) $(MSWIN_FILE) -rm -f $(DEST_SCRIPT)/gvimrc_example.vim $(DEST_SCRIPT)/vimrc_example.vim @@ -3666,12 +3659,10 @@ Makefile: # This rule: # - add resources to already installed vim binary to avoid # stripping them during install; -# - copy rgb.txt to runtime directory; # - update system MIME database with info about vim application. # install_haiku_extra: $(DEST_BIN)/$(VIMTARGET) objects/os_haiku.rsrc xres -o $(DEST_BIN)/$(VIMTARGET) objects/os_haiku.rsrc - $(INSTALL_DATA) $(SCRIPTSOURCE)/rgb.txt $(DEST_RT) mimeset $(DEST_BIN)/$(VIMTARGET) # List of g*-links that should be replaced with shell script equivalents. diff --git a/src/errors.h b/src/errors.h index 7778b39602..537072d7d5 100644 --- a/src/errors.h +++ b/src/errors.h @@ -147,6 +147,10 @@ EXTERN char e_no_such_user_defined_command_str[] EXTERN char e_no_digraphs_version[] INIT(= N_("E196: No digraphs in this version")); #endif +#if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) +EXTERN char e_cannot_allocate_color_str[] + INIT(= N_("E254: Cannot allocate color %s")); +#endif EXTERN char e_ambiguous_use_of_user_defined_command[] INIT(= N_("E464: Ambiguous use of user-defined command")); EXTERN char e_invalid_command[] @@ -678,3 +682,5 @@ EXTERN char e_no_white_space_allowed_before_separator_str[] INIT(= N_("E1242: No white space allowed before separator: %s")); EXTERN char e_ascii_code_not_in_range[] INIT(= N_("E1243: ASCII code not in 32-127 range")); +EXTERN char e_bad_color_string_str[] + INIT(= N_("E1244: Bad color string: %s")); diff --git a/src/evalvars.c b/src/evalvars.c index fbf2d68d1b..08736dd8c7 100644 --- a/src/evalvars.c +++ b/src/evalvars.c @@ -149,6 +149,7 @@ static struct vimvar {VV_NAME("argv", VAR_LIST), VV_RO}, {VV_NAME("collate", VAR_STRING), VV_RO}, {VV_NAME("exiting", VAR_SPECIAL), VV_RO}, + {VV_NAME("colornames", VAR_DICT), VV_RO}, }; // shorthand @@ -248,6 +249,8 @@ evalvars_init(void) set_vim_var_nr(VV_ECHOSPACE, sc_col - 1); + set_vim_var_dict(VV_COLORNAMES, dict_alloc()); + // Default for v:register is not 0 but '"'. This is adjusted once the // clipboard has been setup by calling reset_reg_var(). set_reg_var(0); diff --git a/src/globals.h b/src/globals.h index 948c35f84f..5c54130ebd 100644 --- a/src/globals.h +++ b/src/globals.h @@ -1774,9 +1774,6 @@ EXTERN char e_nowhitespace[] INIT(= N_("E274: No white space allowed before pare EXTERN char e_lock_unlock[] INIT(= N_("E940: Cannot lock or unlock variable %s")); #endif -#if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) -EXTERN char e_alloc_color[] INIT(= N_("E254: Cannot allocate color %s")); -#endif EXTERN char e_chan_or_job_req[] INIT(= N_("E706: Channel or Job required")); EXTERN char e_jobreq[] INIT(= N_("E693: Job required")); diff --git a/src/gui.c b/src/gui.c index 1edf659dd1..68754b3bc0 100644 --- a/src/gui.c +++ b/src/gui.c @@ -4785,7 +4785,7 @@ gui_get_color(char_u *name) && gui.in_use #endif ) - semsg(_(e_alloc_color), name); + semsg(_(e_cannot_allocate_color_str), name); return t; } diff --git a/src/gui_haiku.cc b/src/gui_haiku.cc index 644c2db665..6d973c5656 100644 --- a/src/gui_haiku.cc +++ b/src/gui_haiku.cc @@ -4054,164 +4054,7 @@ guicolor_T gui_mch_get_color( char_u *name) { - typedef struct GuiColourTable - { - const char *name; - guicolor_T colour; - } GuiColourTable; - -#define NSTATIC_COLOURS 50 // 32 -#define NDYNAMIC_COLOURS 33 -#define NCOLOURS (NSTATIC_COLOURS + NDYNAMIC_COLOURS) - - static GuiColourTable table[NCOLOURS] = - { - {"Black", RGB(0x00, 0x00, 0x00)}, - {"DarkGray", RGB(0x80, 0x80, 0x80)}, - {"DarkGrey", RGB(0x80, 0x80, 0x80)}, - {"Gray", RGB(0xC0, 0xC0, 0xC0)}, - {"Grey", RGB(0xC0, 0xC0, 0xC0)}, - {"LightGray", RGB(0xD3, 0xD3, 0xD3)}, - {"LightGrey", RGB(0xD3, 0xD3, 0xD3)}, - {"Gray10", RGB(0x1A, 0x1A, 0x1A)}, - {"Grey10", RGB(0x1A, 0x1A, 0x1A)}, - {"Gray20", RGB(0x33, 0x33, 0x33)}, - {"Grey20", RGB(0x33, 0x33, 0x33)}, - {"Gray30", RGB(0x4D, 0x4D, 0x4D)}, - {"Grey30", RGB(0x4D, 0x4D, 0x4D)}, - {"Gray40", RGB(0x66, 0x66, 0x66)}, - {"Grey40", RGB(0x66, 0x66, 0x66)}, - {"Gray50", RGB(0x7F, 0x7F, 0x7F)}, - {"Grey50", RGB(0x7F, 0x7F, 0x7F)}, - {"Gray60", RGB(0x99, 0x99, 0x99)}, - {"Grey60", RGB(0x99, 0x99, 0x99)}, - {"Gray70", RGB(0xB3, 0xB3, 0xB3)}, - {"Grey70", RGB(0xB3, 0xB3, 0xB3)}, - {"Gray80", RGB(0xCC, 0xCC, 0xCC)}, - {"Grey80", RGB(0xCC, 0xCC, 0xCC)}, - {"Gray90", RGB(0xE5, 0xE5, 0xE5)}, - {"Grey90", RGB(0xE5, 0xE5, 0xE5)}, - {"White", RGB(0xFF, 0xFF, 0xFF)}, - {"DarkRed", RGB(0x80, 0x00, 0x00)}, - {"Red", RGB(0xFF, 0x00, 0x00)}, - {"LightRed", RGB(0xFF, 0xA0, 0xA0)}, - {"DarkBlue", RGB(0x00, 0x00, 0x80)}, - {"Blue", RGB(0x00, 0x00, 0xFF)}, - {"LightBlue", RGB(0xA0, 0xA0, 0xFF)}, - {"DarkGreen", RGB(0x00, 0x80, 0x00)}, - {"Green", RGB(0x00, 0xFF, 0x00)}, - {"LightGreen", RGB(0xA0, 0xFF, 0xA0)}, - {"DarkCyan", RGB(0x00, 0x80, 0x80)}, - {"Cyan", RGB(0x00, 0xFF, 0xFF)}, - {"LightCyan", RGB(0xA0, 0xFF, 0xFF)}, - {"DarkMagenta", RGB(0x80, 0x00, 0x80)}, - {"Magenta", RGB(0xFF, 0x00, 0xFF)}, - {"LightMagenta", RGB(0xFF, 0xA0, 0xFF)}, - {"Brown", RGB(0x80, 0x40, 0x40)}, - {"Yellow", RGB(0xFF, 0xFF, 0x00)}, - {"LightYellow", RGB(0xFF, 0xFF, 0xA0)}, - {"DarkYellow", RGB(0xBB, 0xBB, 0x00)}, - {"SeaGreen", RGB(0x2E, 0x8B, 0x57)}, - {"Orange", RGB(0xFF, 0xA5, 0x00)}, - {"Purple", RGB(0xA0, 0x20, 0xF0)}, - {"SlateBlue", RGB(0x6A, 0x5A, 0xCD)}, - {"Violet", RGB(0xEE, 0x82, 0xEE)}, - // NOTE: some entries are zero-allocated for NDDYNAMIC_COLORS - // in this table! - }; - - static int endColour = NSTATIC_COLOURS; - static int newColour = NSTATIC_COLOURS; - - int r, g, b; - int i; - - if (name[0] == '#' && STRLEN(name) == 7) - { - // Name is in "#rrggbb" format - r = hex_digit(name[1]) * 16 + hex_digit(name[2]); - g = hex_digit(name[3]) * 16 + hex_digit(name[4]); - b = hex_digit(name[5]) * 16 + hex_digit(name[6]); - if (r < 0 || g < 0 || b < 0) - return INVALCOLOR; - return RGB(r, g, b); - } - else - { - // Check if the name is one of the colours we know - for (i = 0; i < endColour; i++) - if (STRICMP(name, table[i].name) == 0) - return table[i].colour; - } - - /* - * Last attempt. Look in the file "$VIMRUNTIME/rgb.txt". - */ - { -#define LINE_LEN 100 - FILE *fd; - char line[LINE_LEN]; - char_u *fname; - - fname = expand_env_save((char_u *)"$VIMRUNTIME/rgb.txt"); - if (fname == NULL) - return INVALCOLOR; - - fd = fopen((char *)fname, "rt"); - vim_free(fname); - if (fd == NULL) - return INVALCOLOR; - - while (!feof(fd)) - { - int len; - int pos; - char *colour; - - fgets(line, LINE_LEN, fd); - len = strlen(line); - - if (len <= 1 || line[len-1] != '\n') - continue; - - line[len-1] = '\0'; - - i = sscanf(line, "%d %d %d %n", &r, &g, &b, &pos); - if (i != 3) - continue; - - colour = line + pos; - - if (STRICMP(colour, name) == 0) - { - fclose(fd); - /* - * Now remember this colour in the table. - * A LRU scheme might be better but this is simpler. - * Or could use a growing array. - */ - guicolor_T gcolour = RGB(r,g,b); - - // NOTE: see note above in table allocation! We are working here with - // dynamically allocated names, not constant ones! - vim_free((char*)table[newColour].name); - table[newColour].name = (char *)vim_strsave((char_u *)colour); - table[newColour].colour = gcolour; - - newColour++; - if (newColour >= NCOLOURS) - newColour = NSTATIC_COLOURS; - if (endColour < NCOLOURS) - endColour = newColour; - - return gcolour; - } - } - - fclose(fd); - } - - return INVALCOLOR; + return gui_get_color_cmn(name); } /* diff --git a/src/highlight.c b/src/highlight.c index 76d9a7e82e..5dde08b8f3 100644 --- a/src/highlight.c +++ b/src/highlight.c @@ -475,6 +475,9 @@ load_colors(char_u *name) buf = alloc(STRLEN(name) + 12); if (buf != NULL) { +#ifdef FEAT_EVAL + load_default_colors_lists(); +#endif apply_autocmds(EVENT_COLORSCHEMEPRE, name, curbuf->b_fname, FALSE, curbuf); sprintf((char *)buf, "colors/%s.vim", name); @@ -1190,7 +1193,7 @@ highlight_set_guibg( HL_TABLE()[idx].sg_set |= SG_GUI; # if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) - // In GUI guifg colors are only used when recognized + // In GUI guibg colors are only used when recognized i = color_name2handle(arg); if (i != INVALCOLOR || STRCMP(arg, "NONE") == 0 || !USE_24BIT) { @@ -2231,6 +2234,234 @@ color_name2handle(char_u *name) return GUI_GET_COLOR(name); } + +// On MS-Windows an RGB macro is available and it produces 0x00bbggrr color +// values as used by the MS-Windows GDI api. It should be used only for +// MS-Windows GDI builds. +# if defined(RGB) && defined(MSWIN) && !defined(FEAT_GUI) +# undef RGB +# endif +# ifndef RGB +# define RGB(r, g, b) ((r<<16) | (g<<8) | (b)) +# endif + +# ifdef VIMDLL + static guicolor_T +gui_adjust_rgb(guicolor_T c) +{ + if (gui.in_use) + return c; + else + return ((c & 0xff) << 16) | (c & 0x00ff00) | ((c >> 16) & 0xff); +} +# else +# define gui_adjust_rgb(c) (c) +# endif + + static int +hex_digit(int c) +{ + if (isdigit(c)) + return c - '0'; + c = TOLOWER_ASC(c); + if (c >= 'a' && c <= 'f') + return c - 'a' + 10; + return 0x1ffffff; +} + + guicolor_T +decode_hex_color(char_u *hex) +{ + guicolor_T color; + + if (hex[0] != '#' || STRLEN(hex) != 7) + return INVALCOLOR; + + // Name is in "#rrggbb" format + color = RGB(((hex_digit(hex[1]) << 4) + hex_digit(hex[2])), + ((hex_digit(hex[3]) << 4) + hex_digit(hex[4])), + ((hex_digit(hex[5]) << 4) + hex_digit(hex[6]))); + if (color > 0xffffff) + return INVALCOLOR; + return gui_adjust_rgb(color); +} + +#if defined(FEAT_EVAL) +// Returns the color currently mapped to the given name or INVALCOLOR if no +// such name exists in the color table. The convention is to use lowercase for +// all keys in the v:colornames dictionary. The value can be either a string in +// the form #rrggbb or a number, either of which is converted to a guicolor_T. + guicolor_T +colorname2rgb(char_u *name) +{ + dict_T *colornames_table = get_vim_var_dict(VV_COLORNAMES); + char_u *lc_name; + dictitem_T *colentry; + char_u *colstr; + varnumber_T colnum; + + lc_name = strlow_save(name); + if (lc_name == NULL) + return INVALCOLOR; + + colentry = dict_find(colornames_table, lc_name, -1); + vim_free(lc_name); + if (colentry == NULL) + return INVALCOLOR; + + if (colentry->di_tv.v_type == VAR_STRING) + { + colstr = tv_get_string_strict(&colentry->di_tv); + if ((STRLEN(colstr) == 7) && (*colstr == '#')) + { + return decode_hex_color(colstr); + } + else + { + semsg(_(e_bad_color_string_str), colstr); + return INVALCOLOR; + } + } + + if (colentry->di_tv.v_type == VAR_NUMBER) + { + colnum = tv_get_number(&colentry->di_tv); + return (guicolor_T)colnum; + } + + return INVALCOLOR; +} + +// Maps the given name to the given color value, overwriting any current +// mapping. If allocation fails the named color will no longer exist in the +// table and the user will receive an error message. + void +save_colorname_hexstr(int r, int g, int b, char_u *name) +{ + int result; + dict_T *colornames_table; + dictitem_T *existing; + char_u hexstr[8]; + + if (vim_snprintf((char *)hexstr, sizeof(hexstr), + "#%02x%02x%02x", r, g, b) < 0) + { + semsg(_(e_cannot_allocate_color_str), name); + return; + } + + colornames_table = get_vim_var_dict(VV_COLORNAMES); + // The colornames_table dict is safe to use here because it is allocated at + // startup in evalvars.c + existing = dict_find(colornames_table, name, -1); + if (existing != NULL) + { + dictitem_remove(colornames_table, existing); + existing = NULL; // dictitem_remove freed the item + } + + result = dict_add_string(colornames_table, (char *)name, hexstr); + if (result == FAIL) + semsg(_(e_cannot_allocate_color_str), name); +} + +/* + * Load a default color list. Intended to support legacy color names but allows + * the user to override the color values. Only loaded once. + */ + void +load_default_colors_lists() +{ + // Lacking a default color list isn't the end of the world but it is likely + // an inconvenience so users should know when it is missing. + if (source_runtime((char_u *)"colors/lists/default.vim", DIP_ALL) != OK) + msg("failed to load colors/lists/default.vim"); +} +#endif + + guicolor_T +gui_get_color_cmn(char_u *name) +{ + int i; + guicolor_T color; + + struct rgbcolor_table_S { + char_u *color_name; + guicolor_T color; + }; + + // Only non X11 colors (not present in rgb.txt) and colors in + // color_names[], useful when $VIMRUNTIME is not found,. + static struct rgbcolor_table_S rgb_table[] = { + {(char_u *)"black", RGB(0x00, 0x00, 0x00)}, + {(char_u *)"blue", RGB(0x00, 0x00, 0xFF)}, + {(char_u *)"brown", RGB(0xA5, 0x2A, 0x2A)}, + {(char_u *)"cyan", RGB(0x00, 0xFF, 0xFF)}, + {(char_u *)"darkblue", RGB(0x00, 0x00, 0x8B)}, + {(char_u *)"darkcyan", RGB(0x00, 0x8B, 0x8B)}, + {(char_u *)"darkgray", RGB(0xA9, 0xA9, 0xA9)}, + {(char_u *)"darkgreen", RGB(0x00, 0x64, 0x00)}, + {(char_u *)"darkgrey", RGB(0xA9, 0xA9, 0xA9)}, + {(char_u *)"darkmagenta", RGB(0x8B, 0x00, 0x8B)}, + {(char_u *)"darkred", RGB(0x8B, 0x00, 0x00)}, + {(char_u *)"darkyellow", RGB(0x8B, 0x8B, 0x00)}, // No X11 + {(char_u *)"gray", RGB(0xBE, 0xBE, 0xBE)}, + {(char_u *)"green", RGB(0x00, 0xFF, 0x00)}, + {(char_u *)"grey", RGB(0xBE, 0xBE, 0xBE)}, + {(char_u *)"grey40", RGB(0x66, 0x66, 0x66)}, + {(char_u *)"grey50", RGB(0x7F, 0x7F, 0x7F)}, + {(char_u *)"grey90", RGB(0xE5, 0xE5, 0xE5)}, + {(char_u *)"lightblue", RGB(0xAD, 0xD8, 0xE6)}, + {(char_u *)"lightcyan", RGB(0xE0, 0xFF, 0xFF)}, + {(char_u *)"lightgray", RGB(0xD3, 0xD3, 0xD3)}, + {(char_u *)"lightgreen", RGB(0x90, 0xEE, 0x90)}, + {(char_u *)"lightgrey", RGB(0xD3, 0xD3, 0xD3)}, + {(char_u *)"lightmagenta", RGB(0xFF, 0x8B, 0xFF)}, // No X11 + {(char_u *)"lightred", RGB(0xFF, 0x8B, 0x8B)}, // No X11 + {(char_u *)"lightyellow", RGB(0xFF, 0xFF, 0xE0)}, + {(char_u *)"magenta", RGB(0xFF, 0x00, 0xFF)}, + {(char_u *)"red", RGB(0xFF, 0x00, 0x00)}, + {(char_u *)"seagreen", RGB(0x2E, 0x8B, 0x57)}, + {(char_u *)"white", RGB(0xFF, 0xFF, 0xFF)}, + {(char_u *)"yellow", RGB(0xFF, 0xFF, 0x00)}, + }; + + color = decode_hex_color(name); + if (color != INVALCOLOR) + return color; + + // Check if the name is one of the colors we know + for (i = 0; i < (int)ARRAY_LENGTH(rgb_table); i++) + if (STRICMP(name, rgb_table[i].color_name) == 0) + return gui_adjust_rgb(rgb_table[i].color); + +#if defined(FEAT_EVAL) + /* + * Not a traditional color. Load additional color aliases and then consult the alias table. + */ + + color = colorname2rgb(name); + if (color == INVALCOLOR) + { + load_default_colors_lists(); + color = colorname2rgb(name); + } + + return color; +#else + return INVALCOLOR; +#endif +} + + guicolor_T +gui_get_rgb_color_cmn(int r, int g, int b) +{ + guicolor_T color = RGB(r, g, b); + + if (color > 0xffffff) + return INVALCOLOR; + return gui_adjust_rgb(color); +} #endif /* diff --git a/src/job.c b/src/job.c index afa9972a76..fcb482c706 100644 --- a/src/job.c +++ b/src/job.c @@ -559,7 +559,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2) { if (called_emsg_before == called_emsg) // may not get the error if the GUI didn't start - semsg(_(e_alloc_color), color_name); + semsg(_(e_cannot_allocate_color_str), color_name); return FAIL; } diff --git a/src/proto/highlight.pro b/src/proto/highlight.pro index ca4498140c..4c6b2f75c0 100644 --- a/src/proto/highlight.pro +++ b/src/proto/highlight.pro @@ -14,6 +14,12 @@ void hl_set_font_name(char_u *font_name); void hl_set_bg_color_name(char_u *name); void hl_set_fg_color_name(char_u *name); guicolor_T color_name2handle(char_u *name); +guicolor_T decode_hex_color(char_u *hex); +guicolor_T colorname2rgb(char_u *name); +void save_colorname_hexstr(int r, int g, int b, char_u *name); +void load_default_colors_lists(void); +guicolor_T gui_get_color_cmn(char_u *name); +guicolor_T gui_get_rgb_color_cmn(int r, int g, int b); int get_cterm_attr_idx(int attr, int fg, int bg); int get_tgc_attr_idx(int attr, guicolor_T fg, guicolor_T bg); int get_gui_attr_idx(int attr, guicolor_T fg, guicolor_T bg); diff --git a/src/proto/term.pro b/src/proto/term.pro index efb2555343..572a41db7a 100644 --- a/src/proto/term.pro +++ b/src/proto/term.pro @@ -83,8 +83,6 @@ void show_termcodes(void); int show_one_termcode(char_u *name, char_u *code, int printit); void update_tcap(int attr); void swap_tcap(void); -guicolor_T gui_get_color_cmn(char_u *name); -guicolor_T gui_get_rgb_color_cmn(int r, int g, int b); void cterm_color2rgb(int nr, char_u *r, char_u *g, char_u *b, char_u *ansi_idx); void term_replace_bs_del_keycode(char_u *ta_buf, int ta_len, int len); /* vim: set ft=c : */ diff --git a/src/term.c b/src/term.c index b61667de8c..cb38b93387 100644 --- a/src/term.c +++ b/src/term.c @@ -1353,7 +1353,7 @@ termgui_get_color(char_u *name) t = termgui_mch_get_color(name); if (t == INVALCOLOR) - semsg(_(e_alloc_color), name); + semsg(_(e_cannot_allocate_color_str), name); return t; } @@ -6630,203 +6630,6 @@ swap_tcap(void) #endif -#if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) || defined(PROTO) - static int -hex_digit(int c) -{ - if (isdigit(c)) - return c - '0'; - c = TOLOWER_ASC(c); - if (c >= 'a' && c <= 'f') - return c - 'a' + 10; - return 0x1ffffff; -} - -# ifdef VIMDLL - static guicolor_T -gui_adjust_rgb(guicolor_T c) -{ - if (gui.in_use) - return c; - else - return ((c & 0xff) << 16) | (c & 0x00ff00) | ((c >> 16) & 0xff); -} -# else -# define gui_adjust_rgb(c) (c) -# endif - - guicolor_T -gui_get_color_cmn(char_u *name) -{ - // On MS-Windows an RGB macro is available and it produces 0x00bbggrr color - // values as used by the MS-Windows GDI api. It should be used only for - // MS-Windows GDI builds. -# if defined(RGB) && defined(MSWIN) && !defined(FEAT_GUI) -# undef RGB -# endif -# ifndef RGB -# define RGB(r, g, b) ((r<<16) | (g<<8) | (b)) -# endif -# define LINE_LEN 100 - FILE *fd; - char line[LINE_LEN]; - char_u *fname; - int r, g, b, i; - guicolor_T color; - - struct rgbcolor_table_S { - char_u *color_name; - guicolor_T color; - }; - - // Only non X11 colors (not present in rgb.txt) and colors in - // color_names[], useful when $VIMRUNTIME is not found,. - static struct rgbcolor_table_S rgb_table[] = { - {(char_u *)"black", RGB(0x00, 0x00, 0x00)}, - {(char_u *)"blue", RGB(0x00, 0x00, 0xFF)}, - {(char_u *)"brown", RGB(0xA5, 0x2A, 0x2A)}, - {(char_u *)"cyan", RGB(0x00, 0xFF, 0xFF)}, - {(char_u *)"darkblue", RGB(0x00, 0x00, 0x8B)}, - {(char_u *)"darkcyan", RGB(0x00, 0x8B, 0x8B)}, - {(char_u *)"darkgray", RGB(0xA9, 0xA9, 0xA9)}, - {(char_u *)"darkgreen", RGB(0x00, 0x64, 0x00)}, - {(char_u *)"darkgrey", RGB(0xA9, 0xA9, 0xA9)}, - {(char_u *)"darkmagenta", RGB(0x8B, 0x00, 0x8B)}, - {(char_u *)"darkred", RGB(0x8B, 0x00, 0x00)}, - {(char_u *)"darkyellow", RGB(0x8B, 0x8B, 0x00)}, // No X11 - {(char_u *)"gray", RGB(0xBE, 0xBE, 0xBE)}, - {(char_u *)"green", RGB(0x00, 0xFF, 0x00)}, - {(char_u *)"grey", RGB(0xBE, 0xBE, 0xBE)}, - {(char_u *)"grey40", RGB(0x66, 0x66, 0x66)}, - {(char_u *)"grey50", RGB(0x7F, 0x7F, 0x7F)}, - {(char_u *)"grey90", RGB(0xE5, 0xE5, 0xE5)}, - {(char_u *)"lightblue", RGB(0xAD, 0xD8, 0xE6)}, - {(char_u *)"lightcyan", RGB(0xE0, 0xFF, 0xFF)}, - {(char_u *)"lightgray", RGB(0xD3, 0xD3, 0xD3)}, - {(char_u *)"lightgreen", RGB(0x90, 0xEE, 0x90)}, - {(char_u *)"lightgrey", RGB(0xD3, 0xD3, 0xD3)}, - {(char_u *)"lightmagenta", RGB(0xFF, 0x8B, 0xFF)}, // No X11 - {(char_u *)"lightred", RGB(0xFF, 0x8B, 0x8B)}, // No X11 - {(char_u *)"lightyellow", RGB(0xFF, 0xFF, 0xE0)}, - {(char_u *)"magenta", RGB(0xFF, 0x00, 0xFF)}, - {(char_u *)"red", RGB(0xFF, 0x00, 0x00)}, - {(char_u *)"seagreen", RGB(0x2E, 0x8B, 0x57)}, - {(char_u *)"white", RGB(0xFF, 0xFF, 0xFF)}, - {(char_u *)"yellow", RGB(0xFF, 0xFF, 0x00)}, - }; - - static struct rgbcolor_table_S *colornames_table; - static int size = 0; - - if (name[0] == '#' && STRLEN(name) == 7) - { - // Name is in "#rrggbb" format - color = RGB(((hex_digit(name[1]) << 4) + hex_digit(name[2])), - ((hex_digit(name[3]) << 4) + hex_digit(name[4])), - ((hex_digit(name[5]) << 4) + hex_digit(name[6]))); - if (color > 0xffffff) - return INVALCOLOR; - return gui_adjust_rgb(color); - } - - // Check if the name is one of the colors we know - for (i = 0; i < (int)ARRAY_LENGTH(rgb_table); i++) - if (STRICMP(name, rgb_table[i].color_name) == 0) - return gui_adjust_rgb(rgb_table[i].color); - - /* - * Last attempt. Look in the file "$VIMRUNTIME/rgb.txt". - */ - if (size == 0) - { - int counting; - - // colornames_table not yet initialized - fname = expand_env_save((char_u *)"$VIMRUNTIME/rgb.txt"); - if (fname == NULL) - return INVALCOLOR; - - fd = fopen((char *)fname, "rt"); - vim_free(fname); - if (fd == NULL) - { - if (p_verbose > 1) - verb_msg(_("Cannot open $VIMRUNTIME/rgb.txt")); - size = -1; // don't try again - return INVALCOLOR; - } - - for (counting = 1; counting >= 0; --counting) - { - if (!counting) - { - colornames_table = ALLOC_MULT(struct rgbcolor_table_S, size); - if (colornames_table == NULL) - { - fclose(fd); - return INVALCOLOR; - } - rewind(fd); - } - size = 0; - - while (!feof(fd)) - { - size_t len; - int pos; - - vim_ignoredp = fgets(line, LINE_LEN, fd); - len = strlen(line); - - if (len <= 1 || line[len - 1] != '\n') - continue; - - line[len - 1] = '\0'; - - i = sscanf(line, "%d %d %d %n", &r, &g, &b, &pos); - if (i != 3) - continue; - - if (!counting) - { - char_u *s = vim_strsave((char_u *)line + pos); - - if (s == NULL) - { - fclose(fd); - return INVALCOLOR; - } - colornames_table[size].color_name = s; - colornames_table[size].color = (guicolor_T)RGB(r, g, b); - } - size++; - - // The distributed rgb.txt has less than 1000 entries. Limit to - // 10000, just in case the file was messed up. - if (size == 10000) - break; - } - } - fclose(fd); - } - - for (i = 0; i < size; i++) - if (STRICMP(name, colornames_table[i].color_name) == 0) - return gui_adjust_rgb(colornames_table[i].color); - - return INVALCOLOR; -} - - guicolor_T -gui_get_rgb_color_cmn(int r, int g, int b) -{ - guicolor_T color = RGB(r, g, b); - - if (color > 0xffffff) - return INVALCOLOR; - return gui_adjust_rgb(color); -} -#endif #if (defined(MSWIN) && (!defined(FEAT_GUI_MSWIN) || defined(VIMDLL))) || defined(FEAT_TERMINAL) \ || defined(PROTO) diff --git a/src/testdir/test_highlight.vim b/src/testdir/test_highlight.vim index a4c7a72591..d3734b31f2 100644 --- a/src/testdir/test_highlight.vim +++ b/src/testdir/test_highlight.vim @@ -934,4 +934,40 @@ func Test_highlight_default_colorscheme_restores_links() hi clear endfunc +func Test_colornames_assignment_and_lookup() + " Ensure highlight command can find custom color. + let v:colornames['a redish white'] = '#ffeedd' + highlight Normal guifg='a redish white' + highlight clear +endfunc + +func Test_colornames_default_list() + " Ensure default lists are loaded automatically and can be used for all gui fields. + highlight Normal guifg='rebecca purple' guibg='rebecca purple' guisp='rebecca purple' + highlight clear +endfunc + +func Test_colornames_overwrite_default() + " Ensure entries in v:colornames can be overwritten. + " Load default color scheme to trigger default color list loading. + colorscheme default + let old_rebecca_purple = v:colornames['rebecca purple'] + highlight Normal guifg='rebecca purple' guibg='rebecca purple' + let v:colornames['rebecca purple'] = '#550099' + highlight Normal guifg='rebecca purple' guibg='rebecca purple' + let v:colornames['rebecca purple'] = old_rebecca_purple + highlight clear +endfunc + +func Test_colornames_assignment_and_unassignment() + " Ensure we cannot overwrite the v:colornames dict. + call assert_fails("let v:colornames = {}", 'E46:') + + " Ensure we can delete entries from the v:colornames dict. + let v:colornames['x1'] = '#111111' + call assert_equal(v:colornames['x1'], '#111111') + unlet v:colornames['x1'] + call assert_fails("echo v:colornames['x1']") +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/version.c b/src/version.c index 7dc55ac95a..3bba9728a4 100644 --- a/src/version.c +++ b/src/version.c @@ -757,6 +757,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 3562, /**/ 3561, /**/ diff --git a/src/vim.h b/src/vim.h index 0ce0e964e2..31d4bdefe8 100644 --- a/src/vim.h +++ b/src/vim.h @@ -2044,7 +2044,8 @@ typedef int sock_T; #define VV_ARGV 96 #define VV_COLLATE 97 #define VV_EXITING 98 -#define VV_LEN 99 // number of v: vars +#define VV_COLORNAMES 99 +#define VV_LEN 100 // number of v: vars // used for v_number in VAR_BOOL and VAR_SPECIAL #define VVAL_FALSE 0L // VAR_BOOL