aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/mapping.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-04-08 08:21:09 +0800
committerGitHub <noreply@github.com>2023-04-08 08:21:09 +0800
commitbc66b755f61ba0e3383177b2866e05557ffa3966 (patch)
tree264e65dddb854c7b712cc1ef613ac9e878f87549 /src/nvim/mapping.c
parent8f1541fced2fdcdc378c7a608ed3a6bd94329088 (diff)
downloadrneovim-bc66b755f61ba0e3383177b2866e05557ffa3966.tar.gz
rneovim-bc66b755f61ba0e3383177b2866e05557ffa3966.tar.bz2
rneovim-bc66b755f61ba0e3383177b2866e05557ffa3966.zip
vim-patch:9.0.1442: mapset() does not restore non-script context (#22942)
Problem: mapset() does not restore non-script context. Solution: Also accept negative sid. (closes vim/vim#12132) https://github.com/vim/vim/commit/bfc7cbd1d44e53e844a079d8ad16ae990dad664d
Diffstat (limited to 'src/nvim/mapping.c')
-rw-r--r--src/nvim/mapping.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/nvim/mapping.c b/src/nvim/mapping.c
index 8176fe9ce0..19a2aca75e 100644
--- a/src/nvim/mapping.c
+++ b/src/nvim/mapping.c
@@ -449,7 +449,7 @@ static int str_to_mapargs(const char *strargs, bool is_unmap, MapArguments *mapa
/// @param args "rhs", "rhs_lua", "orig_rhs", "expr", "silent", "nowait", "replace_keycodes" and
/// and "desc" fields are used.
/// "rhs", "rhs_lua", "orig_rhs" fields are cleared if "simplified" is false.
-/// @param sid -1 to use current_sctx
+/// @param sid 0 to use current_sctx
static void map_add(buf_T *buf, mapblock_T **map_table, mapblock_T **abbr_table, const char *keys,
MapArguments *args, int noremap, int mode, bool is_abbr, scid_T sid,
linenr_T lnum, bool simplified)
@@ -482,7 +482,7 @@ static void map_add(buf_T *buf, mapblock_T **map_table, mapblock_T **abbr_table,
mp->m_simplified = simplified;
mp->m_expr = args->expr;
mp->m_replace_keycodes = args->replace_keycodes;
- if (sid >= 0) {
+ if (sid != 0) {
mp->m_script_ctx.sc_sid = sid;
mp->m_script_ctx.sc_lnum = lnum;
} else {
@@ -857,8 +857,8 @@ static int buf_do_map(int maptype, MapArguments *args, int mode, bool is_abbrev,
// Get here when adding a new entry to the maphash[] list or abbrlist.
map_add(buf, map_table, abbr_table, lhs, args, noremap, mode, is_abbrev,
- -1, // sid
- 0, // lnum
+ 0, // sid
+ 0, // lnum
keyround1_simplified);
}