From ca4729948bdc79d2175607194fdd98df7d6eb529 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 21 Jan 2005 11:46:23 +0000 Subject: updated for version 7.0043 --- src/ex_docmd.c | 42 ++++++++++++++++++++++++------------------ src/globals.h | 4 ++++ src/testdir/test.ok | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+), 18 deletions(-) create mode 100644 src/testdir/test.ok (limited to 'src') diff --git a/src/ex_docmd.c b/src/ex_docmd.c index 44c290d1f3..47f7c64b98 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -7509,27 +7509,28 @@ ex_redir(eap) { char *mode; char_u *fname; + char_u *arg = eap->arg; if (STRICMP(eap->arg, "END") == 0) close_redir(); else { - if (*eap->arg == '>') + if (*arg == '>') { - ++eap->arg; - if (*eap->arg == '>') + ++arg; + if (*arg == '>') { - ++eap->arg; + ++arg; mode = "a"; } else mode = "w"; - eap->arg = skipwhite(eap->arg); + arg = skipwhite(arg); close_redir(); /* Expand environment variables and "~/". */ - fname = expand_env_save(eap->arg); + fname = expand_env_save(arg); if (fname == NULL) return; #ifdef FEAT_BROWSE @@ -7552,30 +7553,34 @@ ex_redir(eap) vim_free(fname); } #ifdef FEAT_EVAL - else if (*eap->arg == '@') + else if (*arg == '@') { /* redirect to a register a-z (resp. A-Z for appending) */ close_redir(); - ++eap->arg; - if (ASCII_ISALPHA(*eap->arg) + ++arg; + if (ASCII_ISALPHA(*arg) # ifdef FEAT_CLIPBOARD - || *eap->arg == '*' + || *arg == '*' # endif - || *eap->arg == '"') + || *arg == '"') { - redir_reg = *eap->arg; - if (islower(redir_reg) + redir_reg = *arg++; + if (*arg == '>') + ++arg; + else if (*arg == NUL && (islower(redir_reg) # ifdef FEAT_CLIPBOARD - || redir_reg == '*' + || redir_reg == '*' # endif - || redir_reg == '"') + || redir_reg == '"')) { /* make register empty */ write_reg_contents(redir_reg, (char_u *)"", -1, FALSE); } + if (*arg != NUL) + EMSG2(_(e_invarg2), eap->arg); } else - EMSG(_(e_invarg)); + EMSG2(_(e_invarg2), eap->arg); } #endif @@ -7584,7 +7589,7 @@ ex_redir(eap) /* TODO: redirect to an internal variable */ else - EMSG(_(e_invarg)); + EMSG2(_(e_invarg2), eap->arg); } } @@ -7743,7 +7748,8 @@ ex_mkrc(eap) #if defined(FEAT_SESSION) && defined(vim_mkdir) /* When using 'viewdir' may have to create the directory. */ if (using_vdir && !mch_isdir(p_vdir)) - vim_mkdir(p_vdir, 0755); /* ignore errors, open_exfile() will fail */ + if (vim_mkdir(p_vdir, 0755) != 0) + EMSG2(_("E738: Cannot create directory: %s"), p_vdir); #endif fd = open_exfile(fname, eap->forceit, WRITEBIN); diff --git a/src/globals.h b/src/globals.h index effb4e2b1a..8cac0f761d 100644 --- a/src/globals.h +++ b/src/globals.h @@ -280,9 +280,11 @@ EXTERN scid_T current_SID INIT(= 0); /* ID of script being sourced or current function. */ #endif +#if defined(FEAT_EVAL) || defined(FEAT_SYN_HL) /* Magic number used for hashitem "hi_key" value indicating a deleted item. * Only the address is used. */ EXTERN char_u hash_removed; +#endif EXTERN int scroll_region INIT(= FALSE); /* term supports scroll region */ @@ -1396,7 +1398,9 @@ EXTERN char_u e_invexprmsg[] INIT(=N_("E449: Invalid expression received")); EXTERN char_u e_guarded[] INIT(=N_("E463: Region is guarded, cannot modify")); EXTERN char_u e_nbreadonly[] INIT(=N_("E680: NetBeans does not allow changes in read-only files")); #endif +#if defined(FEAT_EVAL) || defined(FEAT_SYN_HL) EXTERN char_u e_intern2[] INIT(=N_("E685: Internal error: %s")); +#endif #ifdef MACOS_X_UNIX diff --git a/src/testdir/test.ok b/src/testdir/test.ok new file mode 100644 index 0000000000..868b116fb1 --- /dev/null +++ b/src/testdir/test.ok @@ -0,0 +1,32 @@ +start: +[1, 'as''d', [1, 2, function('strlen')], {'a': 1}] +{'a': 1} +1 +Vim(put):E684: +101101 +{'1': 'asd', 'b': [1, 2, function('strlen')], '-1': {'a': 1}}asd +['-1', '1', 'b'] +['asd', [1, 2, function('strlen')], {'a': 1}] +1:'asd' +b:[1, 2, function('strlen')] +-1:{'a': 1} +Vim(call):E737: 3 +{'c': 'ccc', '1': 99, 'b': [1, 2, function('strlen')], '3': 33, '-1': {'a': 1}} +{'c': 'ccc', '1': 99, '3': 33, '-1': {'a': 1}} +101101 +Vim(let):E706: d +Vim(let):E706: l +[1, 'as''d', {'a': 1}] +[4] +{'1': 99, '3': 33} +3000 2900 2001 1600 1501 +Vim(let):E716: 1500 +NONE 2999 +33=999 +{'33': 999} +len: 3 +again: 3 +Vim(call):E725: +g:dict.func-4 +a:function('3') +Vim(let):E698: -- cgit v1.2.3