MCPcopy Index your code
hub / github.com/codeaashu/claude-code / _findInLine

Method _findInLine

src/server/web/public/terminal.js:6525–6548  ·  view source on GitHub ↗
(e3, t3, i2 = {}, s2 = false)

Source from the content-addressed store, hash-verified

6523 this._linesCache = void 0, this._linesCacheDisposables.clear(), this._linesCacheTimeoutId && (window.clearTimeout(this._linesCacheTimeoutId), this._linesCacheTimeoutId = 0);
6524 }
6525 _isWholeWord(e3, t3, i2) {
6526 return (0 === e3 || o.includes(t3[e3 - 1])) && (e3 + i2.length === t3.length || o.includes(t3[e3 + i2.length]));
6527 }
6528 _findInLine(e3, t3, i2 = {}, s2 = false) {
6529 var _a;
6530 const r2 = this._terminal, o2 = t3.startRow, n2 = t3.startCol, h = r2.buffer.active.getLine(o2);
6531 if (h == null ? void 0 : h.isWrapped) return s2 ? void (t3.startCol += r2.cols) : (t3.startRow--, t3.startCol += r2.cols, this._findInLine(e3, t3, i2));
6532 let a = (_a = this._linesCache) == null ? void 0 : _a[o2];
6533 a || (a = this._translateBufferLineToStringWithWrap(o2, true), this._linesCache && (this._linesCache[o2] = a));
6534 const [l, c] = a, d = this._bufferColsToStringOffset(o2, n2), _ = i2.caseSensitive ? e3 : e3.toLowerCase(), u = i2.caseSensitive ? l : l.toLowerCase();
6535 let f = -1;
6536 if (i2.regex) {
6537 const t4 = RegExp(_, "g");
6538 let i3;
6539 if (s2) for (; i3 = t4.exec(u.slice(0, d)); ) f = t4.lastIndex - i3[0].length, e3 = i3[0], t4.lastIndex -= e3.length - 1;
6540 else i3 = t4.exec(u.slice(d)), i3 && i3[0].length > 0 && (f = d + (t4.lastIndex - i3[0].length), e3 = i3[0]);
6541 } else s2 ? d - _.length >= 0 && (f = u.lastIndexOf(_, d - _.length)) : f = u.indexOf(_, d);
6542 if (f >= 0) {
6543 if (i2.wholeWord && !this._isWholeWord(f, u, e3)) return;
6544 let t4 = 0;
6545 for (; t4 < c.length - 1 && f >= c[t4 + 1]; ) t4++;
6546 let s3 = t4;
6547 for (; s3 < c.length - 1 && f + e3.length >= c[s3 + 1]; ) s3++;
6548 const n3 = f - c[t4], h2 = f + e3.length - c[s3], a2 = this._stringLengthToBufferSize(o2 + t4, n3);
6549 return { term: e3, col: a2, row: o2 + t4, size: this._stringLengthToBufferSize(o2 + s3, h2) - a2 + r2.cols * (s3 - t4) };
6550 }
6551 }

Callers 3

_findMethod · 0.95
_findNextAndSelectMethod · 0.95

Calls 5

_isWholeWordMethod · 0.95
getLineMethod · 0.45

Tested by

no test coverage detected