comparison src/map.c @ 20516:d9e3fdf26cb9 v8.2.0812

patch 8.2.0812: mapset() does not properly handle <> notation Commit: https://github.com/vim/vim/commit/c94c1467b9b86156a6b7c8d3e41ff01c13d2be07 Author: Bram Moolenaar <Bram@vim.org> Date: Fri May 22 20:01:06 2020 +0200 patch 8.2.0812: mapset() does not properly handle <> notation Problem: mapset() does not properly handle <> notation. Solution: Convert <> codes. (closes https://github.com/vim/vim/issues/6116)
author Bram Moolenaar <Bram@vim.org>
date Fri, 22 May 2020 20:15:03 +0200
parents 3d9a2c8d4f95
children 729853a754ea
comparison
equal deleted inserted replaced
20515:313bff7c3f01 20516:d9e3fdf26cb9
2267 char_u buf[NUMBUFLEN]; 2267 char_u buf[NUMBUFLEN];
2268 int is_abbr; 2268 int is_abbr;
2269 dict_T *d; 2269 dict_T *d;
2270 char_u *lhs; 2270 char_u *lhs;
2271 char_u *rhs; 2271 char_u *rhs;
2272 char_u *orig_rhs;
2273 char_u *arg_buf = NULL;
2272 int noremap; 2274 int noremap;
2273 int expr; 2275 int expr;
2274 int silent; 2276 int silent;
2275 scid_T sid; 2277 scid_T sid;
2276 linenr_T lnum; 2278 linenr_T lnum;
2302 if (rhs == NULL) 2304 if (rhs == NULL)
2303 { 2305 {
2304 emsg(_("E99: rhs entry missing in mapset() dict argument")); 2306 emsg(_("E99: rhs entry missing in mapset() dict argument"));
2305 return; 2307 return;
2306 } 2308 }
2309 orig_rhs = rhs;
2310 rhs = replace_termcodes(rhs, &arg_buf,
2311 REPTERM_DO_LT | REPTERM_SPECIAL, NULL);
2307 2312
2308 noremap = dict_get_number(d, (char_u *)"noremap") ? REMAP_NONE: 0; 2313 noremap = dict_get_number(d, (char_u *)"noremap") ? REMAP_NONE: 0;
2309 if (dict_get_number(d, (char_u *)"script") != 0) 2314 if (dict_get_number(d, (char_u *)"script") != 0)
2310 noremap = REMAP_SCRIPT; 2315 noremap = REMAP_SCRIPT;
2311 expr = dict_get_number(d, (char_u *)"expr") != 0; 2316 expr = dict_get_number(d, (char_u *)"expr") != 0;
2328 do_map(1, arg, mode, is_abbr); 2333 do_map(1, arg, mode, is_abbr);
2329 vim_free(arg); 2334 vim_free(arg);
2330 2335
2331 keys = replace_termcodes(lhs, &keys_buf, 2336 keys = replace_termcodes(lhs, &keys_buf,
2332 REPTERM_FROM_PART | REPTERM_DO_LT, NULL); 2337 REPTERM_FROM_PART | REPTERM_DO_LT, NULL);
2333 (void)map_add(map_table, abbr_table, keys, rhs, rhs, noremap, 2338 (void)map_add(map_table, abbr_table, keys, rhs, orig_rhs, noremap,
2334 nowait, silent, mode, is_abbr, expr, sid, lnum, simplified); 2339 nowait, silent, mode, is_abbr, expr, sid, lnum, simplified);
2335 vim_free(keys_buf); 2340 vim_free(keys_buf);
2341 vim_free(arg_buf);
2336 } 2342 }
2337 #endif 2343 #endif
2338 2344
2339 2345
2340 #if defined(MSWIN) || defined(MACOS_X) 2346 #if defined(MSWIN) || defined(MACOS_X)