aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/eval/typval.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2025-02-02 17:32:51 +0800
committerGitHub <noreply@github.com>2025-02-02 09:32:51 +0000
commit4bdabf9b1ae52134f50a0b75dc2c73a40c0c252f (patch)
tree1d57e428e413301df6a6d4c4cdbf7ff7853c8e7c /src/nvim/eval/typval.c
parent718e9ce018572f609a7639865af55476a19847aa (diff)
downloadrneovim-4bdabf9b1ae52134f50a0b75dc2c73a40c0c252f.tar.gz
rneovim-4bdabf9b1ae52134f50a0b75dc2c73a40c0c252f.tar.bz2
rneovim-4bdabf9b1ae52134f50a0b75dc2c73a40c0c252f.zip
vim-patch:9.1.1068: getchar() can't distinguish between C-I and Tab (#32295)
Problem: getchar() can't distinguish between C-I and Tab. Solution: Add {opts} to pass extra flags to getchar() and getcharstr(), with "number" and "simplify" keys. related: vim/vim#10603 closes: vim/vim#16554 https://github.com/vim/vim/commit/e0a2ab397fd13a71efec85b017d5d4d62baf7f63 Cherry-pick tv_dict_has_key() from patch 8.2.4683.
Diffstat (limited to 'src/nvim/eval/typval.c')
-rw-r--r--src/nvim/eval/typval.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/nvim/eval/typval.c b/src/nvim/eval/typval.c
index ed1031577c..48b2e82c0a 100644
--- a/src/nvim/eval/typval.c
+++ b/src/nvim/eval/typval.c
@@ -2234,6 +2234,18 @@ dictitem_T *tv_dict_find(const dict_T *const d, const char *const key, const ptr
return TV_DICT_HI2DI(hi);
}
+/// Check if a key is present in a dictionary.
+///
+/// @param[in] d Dictionary to check.
+/// @param[in] key Dictionary key.
+///
+/// @return whether the key is present in the dictionary.
+bool tv_dict_has_key(const dict_T *const d, const char *const key)
+ FUNC_ATTR_NONNULL_ARG(2) FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
+{
+ return tv_dict_find(d, key, -1) != NULL;
+}
+
/// Get a typval item from a dictionary and copy it into "rettv".
///
/// @param[in] d Dictionary to check.