From a4b80c71eae09a5f6f76bce46be46efd247c7223 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 9 Nov 2023 15:17:53 +0800 Subject: vim-patch:8.2.4140: maparg() does not indicate the type of script Problem: maparg() does not indicate the type of script where it was defined. Solution: Add "scriptversion". https://github.com/vim/vim/commit/a9528b39a666dbaa026320f73bae4b1628a7fe51 Co-authored-by: Bram Moolenaar --- src/nvim/eval.lua | 1 + src/nvim/mapping.c | 1 + 2 files changed, 2 insertions(+) (limited to 'src') diff --git a/src/nvim/eval.lua b/src/nvim/eval.lua index 221be492af..0b81e2eb65 100644 --- a/src/nvim/eval.lua +++ b/src/nvim/eval.lua @@ -6189,6 +6189,7 @@ M.funcs = { (|mapmode-ic|) "sid" The script local ID, used for mappings (||). Negative for special contexts. + "scriptversion" The version of the script, always 1. "lnum" The line number in "sid", zero if unknown. "nowait" Do not wait for other, longer mappings. (|:map-|). diff --git a/src/nvim/mapping.c b/src/nvim/mapping.c index 4435e91993..6786b5efe9 100644 --- a/src/nvim/mapping.c +++ b/src/nvim/mapping.c @@ -2113,6 +2113,7 @@ static Dictionary mapblock_fill_dict(const mapblock_T *const mp, const char *lhs PUT(dict, "expr", INTEGER_OBJ(mp->m_expr ? 1 : 0)); PUT(dict, "silent", INTEGER_OBJ(mp->m_silent ? 1 : 0)); PUT(dict, "sid", INTEGER_OBJ(mp->m_script_ctx.sc_sid)); + PUT(dict, "scriptversion", INTEGER_OBJ(1)); PUT(dict, "lnum", INTEGER_OBJ(mp->m_script_ctx.sc_lnum)); PUT(dict, "buffer", INTEGER_OBJ(buffer_value)); PUT(dict, "nowait", INTEGER_OBJ(mp->m_nowait ? 1 : 0)); -- cgit