MCPcopy Create free account
hub / github.com/codeaashu/claude-code / _findPreviousAndSelect

Method _findPreviousAndSelect

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

Source from the content-addressed store, hash-verified

6495 }
6496 }
6497 this._onDidChangeResults.fire({ resultIndex: e4, resultCount: this._highlightDecorations.length });
6498 }
6499 }
6500 _findPreviousAndSelect(e3, t3) {
6501 var _a;
6502 if (!this._terminal) throw new Error("Cannot use addon until it has been loaded");
6503 if (!this._terminal || !e3 || 0 === e3.length) return (_a = this._terminal) == null ? void 0 : _a.clearSelection(), this.clearDecorations(), false;
6504 const i2 = this._terminal.getSelectionPosition();
6505 this._terminal.clearSelection();
6506 let s2 = this._terminal.buffer.active.baseY + this._terminal.rows - 1, r2 = this._terminal.cols;
6507 const o2 = true;
6508 this._initLinesCache();
6509 const n2 = { startRow: s2, startCol: r2 };
6510 let h;
6511 if (i2 && (n2.startRow = s2 = i2.start.y, n2.startCol = r2 = i2.start.x, this._cachedSearchTerm !== e3 && (h = this._findInLine(e3, n2, t3, false), h || (n2.startRow = s2 = i2.end.y, n2.startCol = r2 = i2.end.x))), h || (h = this._findInLine(e3, n2, t3, o2)), !h) {
6512 n2.startCol = Math.max(n2.startCol, this._terminal.cols);
6513 for (let i3 = s2 - 1; i3 >= 0 && (n2.startRow = i3, h = this._findInLine(e3, n2, t3, o2), !h); i3--) ;
6514 }
6515 if (!h && s2 !== this._terminal.buffer.active.baseY + this._terminal.rows - 1) for (let i3 = this._terminal.buffer.active.baseY + this._terminal.rows - 1; i3 >= s2 && (n2.startRow = i3, h = this._findInLine(e3, n2, t3, o2), !h); i3--) ;
6516 return this._selectResult(h, t3 == null ? void 0 : t3.decorations, t3 == null ? void 0 : t3.noScroll);
6517 }

Callers 1

findPreviousMethod · 0.95

Calls 7

clearDecorationsMethod · 0.95
_initLinesCacheMethod · 0.95
_findInLineMethod · 0.95
_selectResultMethod · 0.95
maxMethod · 0.80
clearSelectionMethod · 0.45
getSelectionPositionMethod · 0.45

Tested by

no test coverage detected