pieceTreeBase.ts ×6

Frontier kind: Code frontier

unlabeled · c_3856abe50fc2

13 tests · 39526 LOC · 238 files · introduces 0 tests · 42 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
6 ranges42 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
4674 ranges39526 lines · 238 files · Browse complete extent
All tests (intent)
13 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

1 file ranked by introduced lines: 42 introduced LOC across 6 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/editor/common/model/pieceTreeTextBuffer/pieceTreeBase.ts 42 introduced LOC · 6 ranges

Open complete file

1682
1683 private fixCRLF(prev: TreeNode, next: TreeNode) {
1684 > const nodesToDel: TreeNode[] = []; pieceTreeBase.ts
1685 > // update node
1686 > const lineStarts = this._buffers[prev.piece.bufferIndex].lineStarts;
1687 > let newEnd: BufferCursor;
1688 > if (prev.piece.end.column === 0) {
1689 // it means, last line ends with \r, not \r\n
1690 newEnd = { line: prev.piece.end.line - 1, column: lineStarts[prev.piece.end.line] - lineStarts[prev.piece.end.line - 1] - 1 };
1691 > } else { pieceTreeBase.ts
1692 // \r\n
1693 newEnd = { line: prev.piece.end.line, column: prev.piece.end.column - 1 };
1694 }
1696 > const prevNewLength = prev.piece.length - 1;
1697 > const prevNewLFCnt = prev.piece.lineFeedCnt - 1;
1698 > prev.piece = new Piece(
1699 > prev.piece.bufferIndex,
1700 > prev.piece.start,
1701 > newEnd,
1702 > prevNewLFCnt,
1703 > prevNewLength
1704 > );
1705 >
1706 > updateTreeMetadata(this, prev, -1, -1);
1707 > if (prev.piece.length === 0) {
1708 nodesToDel.push(prev);
1709 }
1711 > // update nextNode
1712 > const newStart: BufferCursor = { line: next.piece.start.line + 1, column: 0 };
1713 > const newLength = next.piece.length - 1;
1714 > const newLineFeedCnt = this.getLineFeedCnt(next.piece.bufferIndex, newStart, next.piece.end);
1715 > next.piece = new Piece(
1716 > next.piece.bufferIndex,
1717 > newStart,
1718 > next.piece.end,
1719 > newLineFeedCnt,
1720 > newLength
1721 > );
1722 >
1723 > updateTreeMetadata(this, next, -1, -1);
1724 > if (next.piece.length === 0) {
1725 nodesToDel.push(next);
1726 }
1728 > // create new piece which contains \r\n
1729 > const pieces = this.createNewPieces('\r\n');
1730 > this.rbInsertRight(prev, pieces[0]);
1731 > // delete empty nodes
1732 >
1733 > for (let i = 0; i < nodesToDel.length; i++) {
1734 rbDelete(this, nodesToDel[i]);
1735 }
1736 > } pieceTreeBase.ts
1737
1738 private adjustCarriageReturnFromNext(value: string, node: TreeNode): boolean {