pieceTreeBase.ts ×3

Frontier kind: Code frontier

unlabeled · c_4097b26fa3e9

432 tests · 39177 LOC · 238 files · introduces 0 tests · 30 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
3 ranges30 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
4551 ranges39177 lines · 238 files · Browse complete extent
All tests (intent)
432 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: 30 introduced LOC across 3 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/editor/common/model/pieceTreeTextBuffer/pieceTreeBase.ts 30 introduced LOC · 3 ranges

Open complete file

1074 private positionInBuffer(node: TreeNode, remainder: number, ret: BufferCursor): null;
1075 private positionInBuffer(node: TreeNode, remainder: number, ret?: BufferCursor): BufferCursor | null {
1076 > const piece = node.piece; pieceTreeBase.ts
1077 > const bufferIndex = node.piece.bufferIndex;
1078 > const lineStarts = this._buffers[bufferIndex].lineStarts;
1079 >
1080 > const startOffset = lineStarts[piece.start.line] + piece.start.column;
1081 >
1082 > const offset = startOffset + remainder;
1083 >
1084 > // binary search offset between startOffset and endOffset
1085 > let low = piece.start.line;
1086 > let high = piece.end.line;
1087 >
1088 > let mid: number = 0;
1089 > let midStop: number = 0;
1090 > let midStart: number = 0;
1091 >
1092 > while (low <= high) {
1093 > mid = low + ((high - low) / 2) | 0;
1094 > midStart = lineStarts[mid];
1095 >
1096 > if (mid === high) {
1097 break;
1098 }
1107 break;
1108 }
1109 > } pieceTreeBase.ts
1110 >
1111 > if (ret) {
1112 ret.line = mid;
1113 ret.column = offset - midStart;
1114 return null;
1115 }
1117 > return {
1118 > line: mid,
1119 > column: offset - midStart
1120 > };
1121 > }
1122
1123 private getLineFeedCnt(bufferIndex: number, start: BufferCursor, end: BufferCursor): number {