Mercurial > vim
comparison src/ex_docmd.c @ 25575:9f691e8a74e3 v8.2.3324
patch 8.2.3324: Vim9: Cannot use :silent with :endwhile
Commit: https://github.com/vim/vim/commit/917c46abe559f3d779ad87500e874376111ca1ef
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Aug 10 19:53:01 2021 +0200
patch 8.2.3324: Vim9: Cannot use :silent with :endwhile
Problem: Vim9: Cannot use :silent with :endwhile.
Solution: Allow for using the :silent modifier. (closes https://github.com/vim/vim/issues/8737)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 10 Aug 2021 20:00:05 +0200 |
parents | 0082503ff2ff |
children | 15b54e0a576b |
comparison
equal
deleted
inserted
replaced
25574:bd32fe0605af | 25575:9f691e8a74e3 |
---|---|
3059 | 3059 |
3060 /* | 3060 /* |
3061 * Return TRUE if "cmod" has anything set. | 3061 * Return TRUE if "cmod" has anything set. |
3062 */ | 3062 */ |
3063 int | 3063 int |
3064 has_cmdmod(cmdmod_T *cmod) | 3064 has_cmdmod(cmdmod_T *cmod, int ignore_silent) |
3065 { | 3065 { |
3066 return cmod->cmod_flags != 0 | 3066 return (cmod->cmod_flags != 0 && (!ignore_silent |
3067 || (cmod->cmod_flags | |
3068 & ~(CMOD_SILENT | CMOD_ERRSILENT | CMOD_UNSILENT)) != 0)) | |
3067 || cmod->cmod_split != 0 | 3069 || cmod->cmod_split != 0 |
3068 || cmod->cmod_verbose != 0 | 3070 || cmod->cmod_verbose != 0 |
3069 || cmod->cmod_tab != 0 | 3071 || cmod->cmod_tab != 0 |
3070 || cmod->cmod_filter_regmatch.regprog != NULL; | 3072 || cmod->cmod_filter_regmatch.regprog != NULL; |
3071 } | 3073 } |
3072 | 3074 |
3073 /* | 3075 /* |
3074 * If Vim9 script and "cmdmod" has anything set give an error and return TRUE. | 3076 * If Vim9 script and "cmdmod" has anything set give an error and return TRUE. |
3075 */ | 3077 */ |
3076 int | 3078 int |
3077 cmdmod_error(void) | 3079 cmdmod_error(int ignore_silent) |
3078 { | 3080 { |
3079 if (in_vim9script() && has_cmdmod(&cmdmod)) | 3081 if (in_vim9script() && has_cmdmod(&cmdmod, ignore_silent)) |
3080 { | 3082 { |
3081 emsg(_(e_misplaced_command_modifier)); | 3083 emsg(_(e_misplaced_command_modifier)); |
3082 return TRUE; | 3084 return TRUE; |
3083 } | 3085 } |
3084 return FALSE; | 3086 return FALSE; |