diff --git a/xtrn/lord2/l2lib.js b/xtrn/lord2/l2lib.js index ff6518368309954b315ab6fde082daf79637fe6f..d5e4ecd125030c024c4f51cf788b9c5c93b77806 100644 --- a/xtrn/lord2/l2lib.js +++ b/xtrn/lord2/l2lib.js @@ -802,7 +802,7 @@ function broken_displen(str) { var i; - str = expand_ticks(replace_vars(str)); + str = expand_ticks(replace_vars(replace_svars(str))); return str.length; } @@ -1304,7 +1304,6 @@ function replace_vars(str) { if (typeof str !== 'string') return str; - str = str.replace(/([Ss]?&[A-Za-z]+)/g, function(m, r1) { return getvar(r1, true); }); str = str.replace(/(`[Vv][0-4][0-9])/g, function(m, r1) { return getvar(r1, true); }); str = str.replace(/(`[Ss][0-1][0-9])/g, function(m, r1) { return getvar(r1, true); }); str = str.replace(/(`[Pp][0-9][0-9])/g, function(m, r1) { return getvar(r1, true); }); @@ -1316,6 +1315,14 @@ function replace_vars(str) return str; } +function replace_svars(str) +{ + if (typeof str !== 'string') + return str; + str = str.replace(/([Ss]?&[A-Za-z]+)/g, function(m, r1) { return getvar(r1, true); }); + return str; +} + function getoffset(x, y) { return (x * 20 + y); } diff --git a/xtrn/lord2/lord2.js b/xtrn/lord2/lord2.js index 6c107a072a19a1119c4e1cace790272799b18bff..45114f1f825b9a2bb3dce27f08c92469376227e6 100644 --- a/xtrn/lord2/lord2.js +++ b/xtrn/lord2/lord2.js @@ -79,7 +79,7 @@ function redraw_bar(updstatus) function update_bar(str, msg, timeout) { - str = replace_vars(str); + str = replace_vars(replace_svars(str)); var dl = displen(str); var l; @@ -261,7 +261,7 @@ function run_ref(sec, fname) return; if (f.open('ab')) { cl = files[fname].lines[line]; - f.write(replace_vars(cl)+'\r\n'); + f.write(replace_vars(replace_svars(cl))+'\r\n'); f.close(); } }, @@ -548,7 +548,7 @@ function run_ref(sec, fname) if (line > files[fname].lines.length) return; cl = files[fname].lines[line]; - lw(replace_vars(cl)); + lw(replace_vars(replace_svars(cl))); }, }; var handlers = { @@ -1242,7 +1242,7 @@ function run_ref(sec, fname) if (line > files[fname].lines.length) return; cl = files[fname].lines[line]; - morestr = replace_vars(cl); + morestr = replace_vars(replace_svars(cl)); }, 'nocheck':function(args) { // We don't really support this because there's no need for it. @@ -1269,7 +1269,7 @@ function run_ref(sec, fname) if (line > files[fname].lines.length) return; cl = files[fname].lines[line]; - progname = replace_vars(cl); + progname = replace_vars(replace_svars(cl)); }, 'rank':function(args) { // TODO: No real clue what the filename is for... @@ -1447,7 +1447,7 @@ rescan: if (args.length === 0) { l.forEach(function(l) { - lln(replace_vars(l)); + lln(replace_vars(replace_svars(l))); }); } else if (args[0].toLowerCase() === 'scroll') { @@ -1543,7 +1543,7 @@ rescan: if (!f.open('ab')) throw new Error('Unable to open '+f.name+' at '+fname+':'+line); getlines().forEach(function(l) { - f.write(replace_vars(l)+'\r\n'); + f.write(replace_vars(replace_svars(l))+'\r\n'); }); f.close(); },