1
0
forked from aniani/vim

patch 9.0.1687: mapset() not properly handling script ID

Problem: mapset() not properly handling script ID
Solution: replace_termcodes() may accept a script ID

closes: #12699
closes: #12697

Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
This commit is contained in:
zeertzjq
2023-08-11 23:15:38 +02:00
committed by Christian Brabandt
parent cd4e4e169a
commit 7e0bae024d
11 changed files with 53 additions and 22 deletions

View File

@@ -6591,6 +6591,8 @@ term_get_bg_color(char_u *r, char_u *g, char_u *b)
replace_termcodes(
char_u *from,
char_u **bufp,
scid_T sid_arg UNUSED, // script ID to use for <SID>,
// or 0 to use current_sctx
int flags,
int *did_simplify)
{
@@ -6660,12 +6662,12 @@ replace_termcodes(
*/
if (STRNICMP(src, "<SID>", 5) == 0)
{
if (current_sctx.sc_sid <= 0)
if (sid_arg < 0 || (sid_arg == 0 && current_sctx.sc_sid <= 0))
emsg(_(e_using_sid_not_in_script_context));
else
{
char_u *dot;
long sid = current_sctx.sc_sid;
long sid = sid_arg != 0 ? sid_arg : current_sctx.sc_sid;
src += 5;
if (in_vim9script()