Permalink
Browse files

delimit history file on \n\n to support multiline

  • Loading branch information...
1 parent d6c448a commit 44802544f28848d053542db9050595a335e9c398 @jbr committed May 18, 2016
Showing with 7 additions and 7 deletions.
  1. +3 −3 lib/repl.js
  2. +1 −1 maps/repl.map
  3. +3 −3 src/repl.sibilant
View
@@ -18,7 +18,7 @@ fs.access(HISTORY_FILE, fs.R_OK, (function(err) {
return (function() {
if (!(err)) {
- return readline.history = fs.readFileSync(HISTORY_FILE, "utf-8").split("\n").reverse().filter((function() {
+ return readline.history = fs.readFileSync(HISTORY_FILE, "utf-8").split("\n\n").reverse().filter((function() {
/* src/repl.sibilant:23:43 */
return (!!(arguments[0]));
@@ -92,7 +92,7 @@ var handleLine = (function handleLine$(cmd) {
}).call(this);
var result = vm.runInContext(safeJs, context, "sibilant-repl");
readline.history[0] = cmdBuffer;
- fs.write(fd, ("" + cmdBuffer + "\n"));
+ fs.write(fd, ("" + cmdBuffer + "\n\n"));
(function() {
if (typeof result !== "undefined") {
return output.write(("result: " + util.inspect(result, { colors: true }) + "\n"));
@@ -107,7 +107,7 @@ var handleLine = (function handleLine$(cmd) {
return readline.history.shift();
} else {
readline.history[0] = cmdBuffer;
- fs.write(fd, ("" + cmdBuffer + "\n"));
+ fs.write(fd, ("" + cmdBuffer + "\n\n"));
output.write((e.stack + "\n"));
return cmdBuffer = "";
}
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -18,7 +18,7 @@ fs.access(HISTORY-FILE fs.R-OK
(#(err)
(unless err
(|> fs.read-file-sync(HISTORY-FILE "utf-8")
- .split("\n")
+ .split("\n\n")
.reverse
.filter((#-> as-boolean))
set(readline 'history #)))))
@@ -75,7 +75,7 @@ fs.access(HISTORY-FILE fs.R-OK
(var result (vm.run-in-context safe-js context "sibilant-repl"))
(set readline.history 0 cmd-buffer)
- fs.write(fd (""cmd-buffer"\n"))
+ fs.write(fd (""cmd-buffer"\n\n"))
(when (defined? result)
(output.write ("result: "
(util.inspect result { colors true }) "\n")))
@@ -88,7 +88,7 @@ fs.access(HISTORY-FILE fs.R-OK
(readline.history.shift))
(do
(set readline.history 0 cmd-buffer)
- fs.write(fd (""cmd-buffer"\n"))
+ fs.write(fd (""cmd-buffer"\n\n"))
(output.write (concat e.stack "\n"))
(assign cmd-buffer "")))))
(display-prompt))

0 comments on commit 4480254

Please sign in to comment.