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

Class e3

src/server/web/public/terminal.js:1726–1808  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1724 }
1725 t2.JoinedCellData = c;
1726 let l = t2.CharacterJoinerService = class e3 {
1727 constructor(e4) {
1728 this._bufferService = e4, this._characterJoiners = [], this._nextCharacterJoinerId = 0, this._workCell = new a.CellData();
1729 }
1730 register(e4) {
1731 const t3 = { id: this._nextCharacterJoinerId++, handler: e4 };
1732 return this._characterJoiners.push(t3), t3.id;
1733 }
1734 deregister(e4) {
1735 for (let t3 = 0; t3 < this._characterJoiners.length; t3++) if (this._characterJoiners[t3].id === e4) return this._characterJoiners.splice(t3, 1), true;
1736 return false;
1737 }
1738 getJoinedCharacters(e4) {
1739 if (0 === this._characterJoiners.length) return [];
1740 const t3 = this._bufferService.buffer.lines.get(e4);
1741 if (!t3 || 0 === t3.length) return [];
1742 const i3 = [], s3 = t3.translateToString(true);
1743 let r2 = 0, n2 = 0, a2 = 0, h2 = t3.getFg(0), c2 = t3.getBg(0);
1744 for (let e5 = 0; e5 < t3.getTrimmedLength(); e5++) if (t3.loadCell(e5, this._workCell), 0 !== this._workCell.getWidth()) {
1745 if (this._workCell.fg !== h2 || this._workCell.bg !== c2) {
1746 if (e5 - r2 > 1) {
1747 const e6 = this._getJoinedRanges(s3, a2, n2, t3, r2);
1748 for (let t4 = 0; t4 < e6.length; t4++) i3.push(e6[t4]);
1749 }
1750 r2 = e5, a2 = n2, h2 = this._workCell.fg, c2 = this._workCell.bg;
1751 }
1752 n2 += this._workCell.getChars().length || o.WHITESPACE_CELL_CHAR.length;
1753 }
1754 if (this._bufferService.cols - r2 > 1) {
1755 const e5 = this._getJoinedRanges(s3, a2, n2, t3, r2);
1756 for (let t4 = 0; t4 < e5.length; t4++) i3.push(e5[t4]);
1757 }
1758 return i3;
1759 }
1760 _getJoinedRanges(t3, i3, s3, r2, n2) {
1761 const o2 = t3.substring(i3, s3);
1762 let a2 = [];
1763 try {
1764 a2 = this._characterJoiners[0].handler(o2);
1765 } catch (e4) {
1766 console.error(e4);
1767 }
1768 for (let t4 = 1; t4 < this._characterJoiners.length; t4++) try {
1769 const i4 = this._characterJoiners[t4].handler(o2);
1770 for (let t5 = 0; t5 < i4.length; t5++) e3._mergeRanges(a2, i4[t5]);
1771 } catch (e4) {
1772 console.error(e4);
1773 }
1774 return this._stringRangesToCellRanges(a2, r2, n2), a2;
1775 }
1776 _stringRangesToCellRanges(e4, t3, i3) {
1777 let s3 = 0, r2 = false, n2 = 0, a2 = e4[s3];
1778 if (a2) {
1779 for (let h2 = i3; h2 < this._bufferService.cols; h2++) {
1780 const i4 = t3.getWidth(h2), c2 = t3.getString(h2).length || o.WHITESPACE_CELL_CHAR.length;
1781 if (0 !== i4) {
1782 if (!r2 && a2[0] <= n2 && (a2[0] = h2, r2 = true), a2[1] <= n2) {
1783 if (a2[1] = h2, a2 = e4[++s3], !a2) break;

Calls

no outgoing calls

Tested by

no test coverage detected