neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit 115785732ad78e38eb66246f9841e95e88665fe8
parent 1363ef7d50bbaf6988f81cf757a6c731f6e4cf07
Author: zeertzjq <zeertzjq@outlook.com>
Date:   Mon, 15 Dec 2025 07:10:37 +0800

Merge pull request #36958 from janlazo/vim-8.2.4528

vim-patch:8.2.{4528,4529,5161}
Diffstat:
Msrc/nvim/eval/userfunc.c | 26+++++++++++++++++++-------
Msrc/nvim/message.c | 5++++-
Mtest/old/testdir/test_vimscript.vim | 3+++
3 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/src/nvim/eval/userfunc.c b/src/nvim/eval/userfunc.c @@ -3778,21 +3778,33 @@ int func_has_abort(void *cookie) /// Changes "rettv" in-place. void make_partial(dict_T *const selfdict, typval_T *const rettv) { - char *tofree = NULL; - ufunc_T *fp; + ufunc_T *fp = NULL; char fname_buf[FLEN_FIXED + 1]; int error; - if (rettv->v_type == VAR_PARTIAL && rettv->vval.v_partial->pt_func != NULL) { + if (rettv->v_type == VAR_PARTIAL + && rettv->vval.v_partial != NULL + && rettv->vval.v_partial->pt_func != NULL) { fp = rettv->vval.v_partial->pt_func; } else { char *fname = rettv->v_type == VAR_FUNC || rettv->v_type == VAR_STRING ? rettv->vval.v_string + : rettv->vval.v_partial == NULL + ? NULL : rettv->vval.v_partial->pt_name; - // Translate "s:func" to the stored function name. - fname = fname_trans_sid(fname, fname_buf, &tofree, &error); - fp = find_func(fname); - xfree(tofree); + if (fname == NULL) { + // There is no point binding a dict to a NULL function, just create + // a function reference. + rettv->v_type = VAR_FUNC; + rettv->vval.v_string = NULL; + } else { + char *tofree = NULL; + + // Translate "s:func" to the stored function name. + fname = fname_trans_sid(fname, fname_buf, &tofree, &error); + fp = find_func(fname); + xfree(tofree); + } } // Turn "dict.Func" into a partial for "Func" with "dict". diff --git a/src/nvim/message.c b/src/nvim/message.c @@ -1052,8 +1052,11 @@ char *msg_may_trunc(bool force, char *s) return s; } + // If something unexpected happened "room" may be negative, check for that + // just in case. int room = (Rows - cmdline_row - 1) * Columns + sc_col - 1; - if ((force || (shortmess(SHM_TRUNC) && !exmode_active)) + if (room > 0 + && (force || (shortmess(SHM_TRUNC) && !exmode_active)) && (int)strlen(s) - room > 0) { int size = vim_strsize(s); diff --git a/test/old/testdir/test_vimscript.vim b/test/old/testdir/test_vimscript.vim @@ -6569,6 +6569,9 @@ func Test_type() call assert_false(v:true is 1) call assert_false(v:true is v:false) " call assert_false(v:none is 0) + " call assert_false(v:none is []) + " call assert_false(v:none is {}) + " call assert_false(v:none is 'text') call assert_false(v:null is 0) " call assert_false(v:null is v:none)