aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-10-22 10:05:34 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-11-05 18:05:59 +0800
commit562d572926e0c11329c13c9df45be7170888e7f6 (patch)
tree39ed53e9b7ce7761dfdcc717d393b1c56724f05d
parent1bcddd5b53a0993789df7ec91fecea47dcfcccfa (diff)
downloadrneovim-562d572926e0c11329c13c9df45be7170888e7f6.tar.gz
rneovim-562d572926e0c11329c13c9df45be7170888e7f6.tar.bz2
rneovim-562d572926e0c11329c13c9df45be7170888e7f6.zip
vim-patch:8.1.1949: cannot scroll a popup window to the very bottom
Problem: Cannot scroll a popup window to the very bottom. Solution: Scroll to the bottom when the "firstline" property was set to -1. (closes vim/vim#4577) Allow resetting min/max width/height. https://github.com/vim/vim/commit/8c6173c7d3431dd8bc2b6ffc076ef49512a7e175 Co-authored-by: Bram Moolenaar <Bram@vim.org>
-rw-r--r--src/nvim/eval/typval.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/nvim/eval/typval.c b/src/nvim/eval/typval.c
index 11b2b6e5fd..31b73f8d48 100644
--- a/src/nvim/eval/typval.c
+++ b/src/nvim/eval/typval.c
@@ -2061,9 +2061,24 @@ int tv_dict_get_tv(dict_T *d, const char *const key, typval_T *rettv)
varnumber_T tv_dict_get_number(const dict_T *const d, const char *const key)
FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
{
+ return tv_dict_get_number_def(d, key, 0);
+}
+
+/// Get a number item from a dictionary.
+///
+/// Returns "def" if the entry doesn't exist.
+///
+/// @param[in] d Dictionary to get item from.
+/// @param[in] key Key to find in dictionary.
+/// @param[in] def Default value.
+///
+/// @return Dictionary item.
+varnumber_T tv_dict_get_number_def(const dict_T *const d, const char *const key, const int def)
+ FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
+{
dictitem_T *const di = tv_dict_find(d, key, -1);
if (di == NULL) {
- return 0;
+ return def;
}
return tv_get_number(&di->di_tv);
}