string literal error

This commit is contained in:
2026-02-10 17:02:22 -06:00
parent fe5dc6ecc9
commit f44fb502be
5 changed files with 106 additions and 7 deletions

View File

@@ -8255,12 +8255,17 @@ static JSValue js_cell_text_format (JSContext *ctx, JSValue this_val, int argc,
if (!result) { FMT_CLEANUP(); return JS_EXCEPTION; }
res_ref.val = JS_MKPTR (result);
} else {
JSValue orig = js_sub_string_val (ctx, text_ref.val, brace_start, brace_end + 1);
if (JS_IsException (orig)) { FMT_CLEANUP(); return JS_EXCEPTION; }
/* No substitution — treat the '{' as a literal character and rescan
from brace_start + 1 so that real placeholders like {0} inside
the skipped range are still found. */
JSValue ch = js_sub_string_val (ctx, text_ref.val, brace_start, brace_start + 1);
if (JS_IsException (ch)) { FMT_CLEANUP(); return JS_EXCEPTION; }
result = (JSText *)chase (res_ref.val);
result = pretext_concat_value (ctx, result, orig);
result = pretext_concat_value (ctx, result, ch);
if (!result) { FMT_CLEANUP(); return JS_EXCEPTION; }
res_ref.val = JS_MKPTR (result);
pos = brace_start + 1;
continue;
}
pos = brace_end + 1;