UI: cat: proper line breaks when showing .js, .script, or .txt files (#192)

Currently, the HTML line break sequence `<br /><br />` is hardcoded into the dialog box message when showing the content of these file types: ".js", ".script", and ".txt".  By default, the function `dialogBoxCreate()` currently assumes that its first parameter is not HTML, but a text string, so whatever is in the string will appear in the dialog box.  Use the newline character instead for line break.
This commit is contained in:
quacksouls 2022-11-04 22:23:33 +11:00 committed by GitHub
parent 6ac04717fe
commit 55b2cbb549
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

@ -49,7 +49,7 @@ export function cat(args: (string | number | boolean)[], server: BaseServer): vo
} else if (filename.endsWith(".script") || filename.endsWith(".js")) {
const script = Terminal.getScript(relative_filename);
if (script != null) {
dialogBoxCreate(`${script.filename}<br /><br />${script.code}`);
dialogBoxCreate(`${script.filename}\n\n${script.code}`);
return;
}
}

@ -54,7 +54,7 @@ export class TextFile {
/** Shows the content to the user via the game's dialog box. */
show(): void {
dialogBoxCreate(`${this.fn}<br /><br />${this.text}`);
dialogBoxCreate(`${this.fn}\n\n${this.text}`);
}
/** Serialize the current file to a JSON save state. */