mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-17 14:59:16 +02:00
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:
@@ -49,7 +49,7 @@ export function cat(args: (string | number | boolean)[], server: BaseServer): vo
|
|||||||
} else if (filename.endsWith(".script") || filename.endsWith(".js")) {
|
} else if (filename.endsWith(".script") || filename.endsWith(".js")) {
|
||||||
const script = Terminal.getScript(relative_filename);
|
const script = Terminal.getScript(relative_filename);
|
||||||
if (script != null) {
|
if (script != null) {
|
||||||
dialogBoxCreate(`${script.filename}<br /><br />${script.code}`);
|
dialogBoxCreate(`${script.filename}\n\n${script.code}`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ export class TextFile {
|
|||||||
|
|
||||||
/** Shows the content to the user via the game's dialog box. */
|
/** Shows the content to the user via the game's dialog box. */
|
||||||
show(): void {
|
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. */
|
/** Serialize the current file to a JSON save state. */
|
||||||
|
|||||||
Reference in New Issue
Block a user