1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-02-22 15:45:47 +01:00

Register support with a crude kill ring.

This commit is contained in:
Kris Maglione
2011-10-06 01:02:11 -04:00
parent 09a3bfcaac
commit 1b781416c9
10 changed files with 255 additions and 50 deletions

View File

@@ -93,12 +93,32 @@ var ArrayStore = Class("ArrayStore", StoreBase, {
this.fireEvent("push", this._object.length);
},
pop: function pop(value) {
var res = this._object.pop();
this.fireEvent("pop", this._object.length);
pop: function pop(value, ord) {
if (ord == null)
var res = this._object.pop();
else
res = this._object.splice(ord, 1)[0];
this.fireEvent("pop", this._object.length, ord);
return res;
},
shift: function shift(value) {
var res = this._object.shift();
this.fireEvent("shift", this._object.length);
return res;
},
insert: function insert(value, ord) {
if (ord == 0)
this._object.unshift(value);
else
this._object = this._object.slice(0, ord)
.concat([value])
.concat(this._object.slice(ord));
this.fireEvent("insert", this._object.length, ord);
},
truncate: function truncate(length, fromEnd) {
var res = this._object.length;
if (this._object.length > length) {