aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/eval/typval.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-09-12 21:47:35 +0800
committerGitHub <noreply@github.com>2022-09-12 21:47:35 +0800
commit5bc0964b97a77148292addd62867c93c5db29085 (patch)
tree19191cb9abe9377c253cae582137b719d40a72f8 /src/nvim/eval/typval.c
parentafe01842ef37620e63cab815b84c89454a6b4a87 (diff)
downloadrneovim-5bc0964b97a77148292addd62867c93c5db29085.tar.gz
rneovim-5bc0964b97a77148292addd62867c93c5db29085.tar.bz2
rneovim-5bc0964b97a77148292addd62867c93c5db29085.zip
vim-patch:9.0.0299: error messages for setcmdline() could be better (#20169)
Problem: Error messages for setcmdline() could be better. Solution: Use more specific error messages. (Yegappan Lakshmanan, closes vim/vim#10995) https://github.com/vim/vim/commit/25f1e5556259d536c8608185145b0769262873ff Cherry-pick tv_check_for_opt_number_arg() from Vim.
Diffstat (limited to 'src/nvim/eval/typval.c')
-rw-r--r--src/nvim/eval/typval.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/nvim/eval/typval.c b/src/nvim/eval/typval.c
index 2089415ffa..777cdc3013 100644
--- a/src/nvim/eval/typval.c
+++ b/src/nvim/eval/typval.c
@@ -3843,6 +3843,14 @@ int tv_check_for_number_arg(const typval_T *const args, const int idx)
return OK;
}
+/// Check for an optional number argument at "idx"
+int tv_check_for_opt_number_arg(const typval_T *const args, const int idx)
+ FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_PURE
+{
+ return (args[idx].v_type == VAR_UNKNOWN
+ || tv_check_for_number_arg(args, idx) != FAIL) ? OK : FAIL;
+}
+
/// Get the string value of a "stringish" VimL object.
///
/// @param[in] tv Object to get value of.