[PATCH] truncate history array correctly when history=0

13 views
Skip to first unread message

Brian Lewis

unread,
Oct 25, 2011, 5:42:28 PM10/25/11
to dactyl-...@googlegroups.com
# HG changeset patch
# User Brian Lewis <br...@lorf.org>
# Date 1319578930 14400
# Node ID 870e2ded8a83ffa9c9cf083240b4598b04c5f9e3
# Parent dafe9b7e68baf1860bdb3a1faeafe98b4a7d2e59
truncate history array correctly when history=0

diff -r dafe9b7e68ba -r 870e2ded8a83 common/content/commandline.js
--- a/common/content/commandline.js Mon Oct 24 11:21:06 2011 -0400
+++ b/common/content/commandline.js Tue Oct 25 17:42:10 2011 -0400
@@ -945,7 +945,11 @@
dactyl.trapErrors(function () {
this.store.push({ value: str, timestamp: Date.now()*1000, privateData: this.checkPrivate(str) });
}, this);
- this.store = this.store.slice(-options["history"]);
+ let history = options["history"];
+ if (history > 0)
+ this.store = this.store.slice(-history);
+ else
+ this.store = [];
},
/**
* @property {function} Returns whether a data item should be

Kris Maglione

unread,
Oct 25, 2011, 5:50:56 PM10/25/11
to Brian Lewis, dactyl-...@googlegroups.com
Done, though I used a slightly different method.

--
Kris Maglione

Haskell is faster than C++, more concise than Perl, more regular than
Python, more flexible than Ruby, more typeful than C#, more robust
than Java, and has absolutely nothing in common with PHP.
--Autrijus Tang

Reply all
Reply to author
Forward
0 new messages