diff --git a/doc/source/netscriptfunctions.rst b/doc/source/netscriptfunctions.rst
index 8661ee953..63fb428ca 100644
--- a/doc/source/netscriptfunctions.rst
+++ b/doc/source/netscriptfunctions.rst
@@ -346,9 +346,10 @@ scp
ls
^^
-.. js:function:: ls(hostname/ip)
+.. js:function:: ls(hostname/ip, [grep])
:param string hostname/ip: Hostname or IP of the target server
+ :param string grep: a substring to search for in the filename.
Returns an array with the filenames of all files on the specified server (as strings). The returned array
is sorted in alphabetic order
diff --git a/src/Message.js b/src/Message.js
index 667c8d147..0b5b9a98a 100644
--- a/src/Message.js
+++ b/src/Message.js
@@ -42,7 +42,7 @@ function showMessage(msg) {
var txt = "Message received from unknown sender:
" +
"" + msg.msg + "
" +
"This message was saved as " + msg.filename + " onto your home computer.";
- dialogBoxCreate(txt);
+ dialogBoxCreate(txt, true);
}
//Adds a message to a server
diff --git a/src/NetscriptFunctions.js b/src/NetscriptFunctions.js
index 9fde02dae..946ffe38b 100644
--- a/src/NetscriptFunctions.js
+++ b/src/NetscriptFunctions.js
@@ -834,6 +834,16 @@ function NetscriptFunctions(workerScript) {
}
}
+ for (var i = 0; i < server.textFiles.length; i++) {
+ if (filter) {
+ if (server.textFiles[i].fn.includes(filter)) {
+ allFiles.push(server.textFiles[i].fn);
+ }
+ } else {
+ allFiles.push(server.textFiles[i].fn);
+ }
+ }
+
//Sort the files alphabetically then print each
allFiles.sort();
return allFiles;
diff --git a/utils/DialogBox.js b/utils/DialogBox.js
index 8425c053b..44554b562 100644
--- a/utils/DialogBox.js
+++ b/utils/DialogBox.js
@@ -32,7 +32,7 @@ $(document).on('click', '.dialog-box-close-button', function( event ) {
var dialogBoxOpened = false;
-function dialogBoxCreate(txt) {
+function dialogBoxCreate(txt, preformatted) {
var container = document.createElement("div");
container.setAttribute("class", "dialog-box-container");
@@ -43,8 +43,16 @@ function dialogBoxCreate(txt) {
closeButton.setAttribute("class", "dialog-box-close-button");
closeButton.innerHTML = "×"
- var textE = document.createElement("p");
- textE.innerHTML = txt.replace(/(?:\r\n|\r|\n)/g, '
');
+ var textE;
+ if (preformatted) {
+ // For text files as they are often computed data that
+ // shouldn't be wrapped and should retain tabstops.
+ textE = document.createElement("pre");
+ textE.innerHTML = txt;
+ } else {
+ textE = document.createElement("p");
+ textE.innerHTML = txt.replace(/(?:\r\n|\r|\n)/g, '
');
+ }
content.appendChild(closeButton);
content.appendChild(textE);