mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-21 04:47:58 +01:00
Fix serialization of commands with embedded new lines in their args but no heredoc support.
This commit is contained in:
@@ -409,7 +409,9 @@ const Commands = Module("commands", {
|
||||
|
||||
let str = args.literalArg;
|
||||
if (str)
|
||||
res.push(/\n/.test(str) ? "<<EOF\n" + str.replace(/\n$/, "") + "\nEOF" : str);
|
||||
res.push(!/\n/.test(str) ? str :
|
||||
this.hereDoc ? "<<EOF\n" + str.replace(/\n$/, "") + "\nEOF"
|
||||
: str.replace(/\n/, "\n" + res[0].replace(/./g, " ").replace(/.$/, "\\")));
|
||||
return res.join(" ");
|
||||
},
|
||||
|
||||
|
||||
@@ -528,7 +528,7 @@ lookup:
|
||||
"E189: " + filename.quote() + " exists (add ! to override)");
|
||||
|
||||
// TODO: Use a set/specifiable list here:
|
||||
let lines = [cmd.serialize().map(commands.commandToString) for (cmd in commands) if (cmd.serialize)];
|
||||
let lines = [cmd.serialize().map(commands.commandToString, cmd) for (cmd in commands) if (cmd.serialize)];
|
||||
lines = array.flatten(lines);
|
||||
|
||||
lines.unshift('"' + dactyl.version + "\n");
|
||||
|
||||
Reference in New Issue
Block a user