MCPcopy
hub / github.com/codeaashu/claude-code / shiftElements

Method shiftElements

src/server/web/public/terminal.js:2412–2422  ·  view source on GitHub ↗
(e3, t3, i3)

Source from the content-addressed store, hash-verified

2410 e3 > this._length && (e3 = this._length), this._startIndex += e3, this._length -= e3, this.onTrimEmitter.fire(e3);
2411 }
2412 shiftElements(e3, t3, i3) {
2413 if (!(t3 <= 0)) {
2414 if (e3 < 0 || e3 >= this._length) throw new Error("start argument out of range");
2415 if (e3 + i3 < 0) throw new Error("Cannot shift elements in list beyond index 0");
2416 if (i3 > 0) {
2417 for (let s4 = t3 - 1; s4 >= 0; s4--) this.set(e3 + s4 + i3, this.get(e3 + s4));
2418 const s3 = e3 + t3 + i3 - this._length;
2419 if (s3 > 0) for (this._length += s3; this._length > this._maxLength; ) this._length--, this._startIndex++, this.onTrimEmitter.fire(1);
2420 } else for (let s3 = 0; s3 < t3; s3++) this.set(e3 + s3 + i3, this.get(e3 + s3));
2421 }
2422 }
2423 _getCyclicIndex(e3) {
2424 return (this._startIndex + e3) % this._maxLength;
2425 }

Callers 2

reverseIndexMethod · 0.80
scrollMethod · 0.80

Calls 3

setMethod · 0.95
getMethod · 0.95
fireMethod · 0.80

Tested by

no test coverage detected