Skip to content
Browse files

Don't track input_history_id with localstorage. We alsways want it to…

… point to the last command in the list
  • Loading branch information...
1 parent 1e40a21 commit ae1323d4ee0b3b59a8c03547f18d5fc6d302e2e0 Adam Savitzky committed
Showing with 1 addition and 12 deletions.
  1. +1 −12 ui/website/repl.js
View
13 ui/website/repl.js
@@ -132,19 +132,12 @@ var input_history_size = 100;
if (Modernizr.localstorage) {
if (localStorage.getItem("input_history")) {
input_history = JSON.parse(localStorage.getItem("input_history"));
+ input_history_id = input_history.length - 1;
}
if (localStorage.getItem("input_history_current")) {
input_history_current = JSON.parse(localStorage.getItem("input_history_current"));
}
-
- if (localStorage.getItem("input_history_id")) {
- input_history_id = JSON.parse(localStorage.getItem("input_history_id"));
- }
-
- if (localStorage.getItem("input_history_size")) {
- input_history_size = JSON.parse(localStorage.getItem("input_history_size"));
- }
}
// a queue of messages to be sent to the server
@@ -438,7 +431,6 @@ message_handlers[MSG_OUTPUT_PARSE_ERROR] = function(msg) {
if (Modernizr.localstorage) {
localStorage.setItem("input_history", JSON.stringify(input_history));
localStorage.setItem("input_history_current", JSON.stringify(input_history_current));
- localStorage.setItem("input_history_id", input_history_id);
}
// add the julia prompt and the input to the log
@@ -484,7 +476,6 @@ message_handlers[MSG_OUTPUT_PARSE_COMPLETE] = function(msg) {
if (Modernizr.localstorage) {
localStorage.setItem("input_history", JSON.stringify(input_history));
localStorage.setItem("input_history_current", JSON.stringify(input_history_current));
- localStorage.setItem("input_history_id", input_history_id);
}
// add the julia prompt and the input to the log
@@ -825,7 +816,6 @@ $(document).ready(function() {
// Save values to localstorage
if (Modernizr.localstorage) {
localStorage.setItem("input_history_current", JSON.stringify(input_history_current));
- localStorage.setItem("input_history_id", input_history_id);
}
$("#terminal-input").val(input_history_current[input_history_id]);
@@ -845,7 +835,6 @@ $(document).ready(function() {
// Save values to localstorage
if (Modernizr.localstorage) {
localStorage.setItem("input_history_current", JSON.stringify(input_history_current));
- localStorage.setItem("input_history_id", input_history_id);
}
$("#terminal-input").val(input_history_current[input_history_id]);

0 comments on commit ae1323d

Please sign in to comment.
Something went wrong with that request. Please try again.