Merge pull request #126204 from microsoft/hediet/renames
Hediet/renames
This commit is contained in:
commit
e3cfe6c57e
14 changed files with 95 additions and 92 deletions
|
@ -24,7 +24,7 @@ import { ICommandDelegate } from 'vs/editor/browser/view/viewController';
|
|||
import { IContentWidgetData, IOverlayWidgetData, View } from 'vs/editor/browser/view/viewImpl';
|
||||
import { ViewUserInputEvents } from 'vs/editor/browser/view/viewUserInputEvents';
|
||||
import { ConfigurationChangedEvent, EditorLayoutInfo, IEditorOptions, EditorOption, IComputedEditorOptions, FindComputedEditorOptionValueById, filterValidationDecorations } from 'vs/editor/common/config/editorOptions';
|
||||
import { Cursor } from 'vs/editor/common/controller/cursor';
|
||||
import { CursorsController } from 'vs/editor/common/controller/cursor';
|
||||
import { CursorColumns } from 'vs/editor/common/controller/cursorCommon';
|
||||
import { CursorChangeReason, ICursorPositionChangedEvent, ICursorSelectionChangedEvent } from 'vs/editor/common/controller/cursorEvents';
|
||||
import { IPosition, Position } from 'vs/editor/common/core/position';
|
||||
|
@ -1540,7 +1540,7 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
|
|||
break;
|
||||
case OutgoingViewModelEventKind.CursorStateChanged: {
|
||||
if (e.reachedMaxCursorCount) {
|
||||
this._notificationService.warn(nls.localize('cursors.maximum', "The number of cursors has been limited to {0}.", Cursor.MAX_CURSOR_COUNT));
|
||||
this._notificationService.warn(nls.localize('cursors.maximum', "The number of cursors has been limited to {0}.", CursorsController.MAX_CURSOR_COUNT));
|
||||
}
|
||||
|
||||
const positions: Position[] = [];
|
||||
|
|
|
@ -29,7 +29,7 @@ export class CursorModelState {
|
|||
public readonly modelVersionId: number;
|
||||
public readonly cursorState: CursorState[];
|
||||
|
||||
constructor(model: ITextModel, cursor: Cursor) {
|
||||
constructor(model: ITextModel, cursor: CursorsController) {
|
||||
this.modelVersionId = model.getVersionId();
|
||||
this.cursorState = cursor.getCursorStates();
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ class AutoClosedAction {
|
|||
}
|
||||
}
|
||||
|
||||
export class Cursor extends Disposable {
|
||||
export class CursorsController extends Disposable {
|
||||
|
||||
public static readonly MAX_CURSOR_COUNT = 10000;
|
||||
|
||||
|
@ -216,8 +216,8 @@ export class Cursor extends Disposable {
|
|||
|
||||
public setStates(eventsCollector: ViewModelEventsCollector, source: string | null | undefined, reason: CursorChangeReason, states: PartialCursorState[] | null): boolean {
|
||||
let reachedMaxCursorCount = false;
|
||||
if (states !== null && states.length > Cursor.MAX_CURSOR_COUNT) {
|
||||
states = states.slice(0, Cursor.MAX_CURSOR_COUNT);
|
||||
if (states !== null && states.length > CursorsController.MAX_CURSOR_COUNT) {
|
||||
states = states.slice(0, CursorsController.MAX_CURSOR_COUNT);
|
||||
reachedMaxCursorCount = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { CursorContext, CursorState, PartialCursorState } from 'vs/editor/common/controller/cursorCommon';
|
||||
import { OneCursor } from 'vs/editor/common/controller/oneCursor';
|
||||
import { Cursor } from 'vs/editor/common/controller/oneCursor';
|
||||
import { Position } from 'vs/editor/common/core/position';
|
||||
import { ISelection, Selection } from 'vs/editor/common/core/selection';
|
||||
|
||||
|
@ -12,15 +12,15 @@ export class CursorCollection {
|
|||
|
||||
private context: CursorContext;
|
||||
|
||||
private primaryCursor: OneCursor;
|
||||
private secondaryCursors: OneCursor[];
|
||||
private primaryCursor: Cursor;
|
||||
private secondaryCursors: Cursor[];
|
||||
|
||||
// An index which identifies the last cursor that was added / moved (think Ctrl+drag)
|
||||
private lastAddedCursorIndex: number;
|
||||
|
||||
constructor(context: CursorContext) {
|
||||
this.context = context;
|
||||
this.primaryCursor = new OneCursor(context);
|
||||
this.primaryCursor = new Cursor(context);
|
||||
this.secondaryCursors = [];
|
||||
this.lastAddedCursorIndex = 0;
|
||||
}
|
||||
|
@ -167,7 +167,7 @@ export class CursorCollection {
|
|||
}
|
||||
|
||||
private _addSecondaryCursor(): void {
|
||||
this.secondaryCursors.push(new OneCursor(this.context));
|
||||
this.secondaryCursors.push(new Cursor(this.context));
|
||||
this.lastAddedCursorIndex = this.secondaryCursors.length;
|
||||
}
|
||||
|
||||
|
@ -186,8 +186,8 @@ export class CursorCollection {
|
|||
this.secondaryCursors.splice(removeIndex, 1);
|
||||
}
|
||||
|
||||
private _getAll(): OneCursor[] {
|
||||
let result: OneCursor[] = [];
|
||||
private _getAll(): Cursor[] {
|
||||
let result: Cursor[] = [];
|
||||
result[0] = this.primaryCursor;
|
||||
for (let i = 0, len = this.secondaryCursors.length; i < len; i++) {
|
||||
result[i + 1] = this.secondaryCursors[i];
|
||||
|
|
|
@ -9,7 +9,10 @@ import { Range } from 'vs/editor/common/core/range';
|
|||
import { Selection, SelectionDirection } from 'vs/editor/common/core/selection';
|
||||
import { TrackedRangeStickiness } from 'vs/editor/common/model';
|
||||
|
||||
export class OneCursor {
|
||||
/**
|
||||
* Represents a single cursor.
|
||||
*/
|
||||
export class Cursor {
|
||||
|
||||
public modelState!: SingleCursorState;
|
||||
public viewState!: SingleCursorState;
|
||||
|
|
|
@ -235,7 +235,7 @@ class MirrorModel extends BaseMirrorModel implements ICommonModel {
|
|||
public offsetAt(position: IPosition): number {
|
||||
position = this._validatePosition(position);
|
||||
this._ensureLineStarts();
|
||||
return this._lineStarts!.getAccumulatedValue(position.lineNumber - 2) + (position.column - 1);
|
||||
return this._lineStarts!.getPrefixSum(position.lineNumber - 2) + (position.column - 1);
|
||||
}
|
||||
|
||||
public positionAt(offset: number): IPosition {
|
||||
|
|
|
@ -85,9 +85,9 @@ export class PrefixSumComputer {
|
|||
return true;
|
||||
}
|
||||
|
||||
public removeValues(startIndex: number, cnt: number): boolean {
|
||||
public removeValues(startIndex: number, count: number): boolean {
|
||||
startIndex = toUint32(startIndex);
|
||||
cnt = toUint32(cnt);
|
||||
count = toUint32(count);
|
||||
|
||||
const oldValues = this.values;
|
||||
const oldPrefixSum = this.prefixSum;
|
||||
|
@ -96,18 +96,18 @@ export class PrefixSumComputer {
|
|||
return false;
|
||||
}
|
||||
|
||||
let maxCnt = oldValues.length - startIndex;
|
||||
if (cnt >= maxCnt) {
|
||||
cnt = maxCnt;
|
||||
let maxCount = oldValues.length - startIndex;
|
||||
if (count >= maxCount) {
|
||||
count = maxCount;
|
||||
}
|
||||
|
||||
if (cnt === 0) {
|
||||
if (count === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this.values = new Uint32Array(oldValues.length - cnt);
|
||||
this.values = new Uint32Array(oldValues.length - count);
|
||||
this.values.set(oldValues.subarray(0, startIndex), 0);
|
||||
this.values.set(oldValues.subarray(startIndex + cnt), startIndex);
|
||||
this.values.set(oldValues.subarray(startIndex + count), startIndex);
|
||||
|
||||
this.prefixSum = new Uint32Array(this.values.length);
|
||||
if (startIndex - 1 < this.prefixSumValidIndex[0]) {
|
||||
|
@ -119,23 +119,23 @@ export class PrefixSumComputer {
|
|||
return true;
|
||||
}
|
||||
|
||||
public getTotalValue(): number {
|
||||
public getTotalSum(): number {
|
||||
if (this.values.length === 0) {
|
||||
return 0;
|
||||
}
|
||||
return this._getAccumulatedValue(this.values.length - 1);
|
||||
return this._getPrefixSum(this.values.length - 1);
|
||||
}
|
||||
|
||||
public getAccumulatedValue(index: number): number {
|
||||
public getPrefixSum(index: number): number {
|
||||
if (index < 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
index = toUint32(index);
|
||||
return this._getAccumulatedValue(index);
|
||||
return this._getPrefixSum(index);
|
||||
}
|
||||
|
||||
private _getAccumulatedValue(index: number): number {
|
||||
private _getPrefixSum(index: number): number {
|
||||
if (index <= this.prefixSumValidIndex[0]) {
|
||||
return this.prefixSum[index];
|
||||
}
|
||||
|
@ -157,11 +157,11 @@ export class PrefixSumComputer {
|
|||
return this.prefixSum[index];
|
||||
}
|
||||
|
||||
public getIndexOf(accumulatedValue: number): PrefixSumIndexOfResult {
|
||||
accumulatedValue = Math.floor(accumulatedValue); //@perf
|
||||
public getIndexOf(sum: number): PrefixSumIndexOfResult {
|
||||
sum = Math.floor(sum); //@perf
|
||||
|
||||
// Compute all sums (to get a fully valid prefixSum)
|
||||
this.getTotalValue();
|
||||
this.getTotalSum();
|
||||
|
||||
let low = 0;
|
||||
let high = this.values.length - 1;
|
||||
|
@ -175,15 +175,15 @@ export class PrefixSumComputer {
|
|||
midStop = this.prefixSum[mid];
|
||||
midStart = midStop - this.values[mid];
|
||||
|
||||
if (accumulatedValue < midStart) {
|
||||
if (sum < midStart) {
|
||||
high = mid - 1;
|
||||
} else if (accumulatedValue >= midStop) {
|
||||
} else if (sum >= midStop) {
|
||||
low = mid + 1;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return new PrefixSumIndexOfResult(mid, accumulatedValue - midStart);
|
||||
return new PrefixSumIndexOfResult(mid, sum - midStart);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ import { ViewModelDecorations } from 'vs/editor/common/viewModel/viewModelDecora
|
|||
import { RunOnceScheduler } from 'vs/base/common/async';
|
||||
import * as platform from 'vs/base/common/platform';
|
||||
import { EditorTheme } from 'vs/editor/common/view/viewContext';
|
||||
import { Cursor } from 'vs/editor/common/controller/cursor';
|
||||
import { CursorsController } from 'vs/editor/common/controller/cursor';
|
||||
import { PartialCursorState, CursorState, IColumnSelectData, EditOperationType, CursorConfiguration } from 'vs/editor/common/controller/cursorCommon';
|
||||
import { CursorChangeReason } from 'vs/editor/common/controller/cursorEvents';
|
||||
import { IWhitespaceChangeAccessor } from 'vs/editor/common/viewLayout/linesLayout';
|
||||
|
@ -52,7 +52,7 @@ export class ViewModel extends Disposable implements IViewModel {
|
|||
private readonly _lines: IViewModelLinesCollection;
|
||||
public readonly coordinatesConverter: ICoordinatesConverter;
|
||||
public readonly viewLayout: ViewLayout;
|
||||
private readonly _cursor: Cursor;
|
||||
private readonly _cursor: CursorsController;
|
||||
private readonly _decorations: ViewModelDecorations;
|
||||
|
||||
constructor(
|
||||
|
@ -103,7 +103,7 @@ export class ViewModel extends Disposable implements IViewModel {
|
|||
|
||||
this.coordinatesConverter = this._lines.createCoordinatesConverter();
|
||||
|
||||
this._cursor = this._register(new Cursor(model, this, this.coordinatesConverter, this.cursorConfig));
|
||||
this._cursor = this._register(new CursorsController(model, this, this.coordinatesConverter, this.cursorConfig));
|
||||
|
||||
this.viewLayout = this._register(new ViewLayout(this._configuration, this.getLineCount(), scheduleAtNextAnimationFrame));
|
||||
|
||||
|
|
|
@ -22,13 +22,13 @@ suite('Editor ViewModel - PrefixSumComputer', () => {
|
|||
let indexOfResult: PrefixSumIndexOfResult;
|
||||
|
||||
let psc = new PrefixSumComputer(toUint32Array([1, 1, 2, 1, 3]));
|
||||
assert.strictEqual(psc.getTotalValue(), 8);
|
||||
assert.strictEqual(psc.getAccumulatedValue(-1), 0);
|
||||
assert.strictEqual(psc.getAccumulatedValue(0), 1);
|
||||
assert.strictEqual(psc.getAccumulatedValue(1), 2);
|
||||
assert.strictEqual(psc.getAccumulatedValue(2), 4);
|
||||
assert.strictEqual(psc.getAccumulatedValue(3), 5);
|
||||
assert.strictEqual(psc.getAccumulatedValue(4), 8);
|
||||
assert.strictEqual(psc.getTotalSum(), 8);
|
||||
assert.strictEqual(psc.getPrefixSum(-1), 0);
|
||||
assert.strictEqual(psc.getPrefixSum(0), 1);
|
||||
assert.strictEqual(psc.getPrefixSum(1), 2);
|
||||
assert.strictEqual(psc.getPrefixSum(2), 4);
|
||||
assert.strictEqual(psc.getPrefixSum(3), 5);
|
||||
assert.strictEqual(psc.getPrefixSum(4), 8);
|
||||
indexOfResult = psc.getIndexOf(0);
|
||||
assert.strictEqual(indexOfResult.index, 0);
|
||||
assert.strictEqual(indexOfResult.remainder, 0);
|
||||
|
@ -59,21 +59,21 @@ suite('Editor ViewModel - PrefixSumComputer', () => {
|
|||
|
||||
// [1, 2, 2, 1, 3]
|
||||
psc.changeValue(1, 2);
|
||||
assert.strictEqual(psc.getTotalValue(), 9);
|
||||
assert.strictEqual(psc.getAccumulatedValue(0), 1);
|
||||
assert.strictEqual(psc.getAccumulatedValue(1), 3);
|
||||
assert.strictEqual(psc.getAccumulatedValue(2), 5);
|
||||
assert.strictEqual(psc.getAccumulatedValue(3), 6);
|
||||
assert.strictEqual(psc.getAccumulatedValue(4), 9);
|
||||
assert.strictEqual(psc.getTotalSum(), 9);
|
||||
assert.strictEqual(psc.getPrefixSum(0), 1);
|
||||
assert.strictEqual(psc.getPrefixSum(1), 3);
|
||||
assert.strictEqual(psc.getPrefixSum(2), 5);
|
||||
assert.strictEqual(psc.getPrefixSum(3), 6);
|
||||
assert.strictEqual(psc.getPrefixSum(4), 9);
|
||||
|
||||
// [1, 0, 2, 1, 3]
|
||||
psc.changeValue(1, 0);
|
||||
assert.strictEqual(psc.getTotalValue(), 7);
|
||||
assert.strictEqual(psc.getAccumulatedValue(0), 1);
|
||||
assert.strictEqual(psc.getAccumulatedValue(1), 1);
|
||||
assert.strictEqual(psc.getAccumulatedValue(2), 3);
|
||||
assert.strictEqual(psc.getAccumulatedValue(3), 4);
|
||||
assert.strictEqual(psc.getAccumulatedValue(4), 7);
|
||||
assert.strictEqual(psc.getTotalSum(), 7);
|
||||
assert.strictEqual(psc.getPrefixSum(0), 1);
|
||||
assert.strictEqual(psc.getPrefixSum(1), 1);
|
||||
assert.strictEqual(psc.getPrefixSum(2), 3);
|
||||
assert.strictEqual(psc.getPrefixSum(3), 4);
|
||||
assert.strictEqual(psc.getPrefixSum(4), 7);
|
||||
indexOfResult = psc.getIndexOf(0);
|
||||
assert.strictEqual(indexOfResult.index, 0);
|
||||
assert.strictEqual(indexOfResult.remainder, 0);
|
||||
|
@ -101,12 +101,12 @@ suite('Editor ViewModel - PrefixSumComputer', () => {
|
|||
|
||||
// [1, 0, 0, 1, 3]
|
||||
psc.changeValue(2, 0);
|
||||
assert.strictEqual(psc.getTotalValue(), 5);
|
||||
assert.strictEqual(psc.getAccumulatedValue(0), 1);
|
||||
assert.strictEqual(psc.getAccumulatedValue(1), 1);
|
||||
assert.strictEqual(psc.getAccumulatedValue(2), 1);
|
||||
assert.strictEqual(psc.getAccumulatedValue(3), 2);
|
||||
assert.strictEqual(psc.getAccumulatedValue(4), 5);
|
||||
assert.strictEqual(psc.getTotalSum(), 5);
|
||||
assert.strictEqual(psc.getPrefixSum(0), 1);
|
||||
assert.strictEqual(psc.getPrefixSum(1), 1);
|
||||
assert.strictEqual(psc.getPrefixSum(2), 1);
|
||||
assert.strictEqual(psc.getPrefixSum(3), 2);
|
||||
assert.strictEqual(psc.getPrefixSum(4), 5);
|
||||
indexOfResult = psc.getIndexOf(0);
|
||||
assert.strictEqual(indexOfResult.index, 0);
|
||||
assert.strictEqual(indexOfResult.remainder, 0);
|
||||
|
@ -128,12 +128,12 @@ suite('Editor ViewModel - PrefixSumComputer', () => {
|
|||
|
||||
// [1, 0, 0, 0, 3]
|
||||
psc.changeValue(3, 0);
|
||||
assert.strictEqual(psc.getTotalValue(), 4);
|
||||
assert.strictEqual(psc.getAccumulatedValue(0), 1);
|
||||
assert.strictEqual(psc.getAccumulatedValue(1), 1);
|
||||
assert.strictEqual(psc.getAccumulatedValue(2), 1);
|
||||
assert.strictEqual(psc.getAccumulatedValue(3), 1);
|
||||
assert.strictEqual(psc.getAccumulatedValue(4), 4);
|
||||
assert.strictEqual(psc.getTotalSum(), 4);
|
||||
assert.strictEqual(psc.getPrefixSum(0), 1);
|
||||
assert.strictEqual(psc.getPrefixSum(1), 1);
|
||||
assert.strictEqual(psc.getPrefixSum(2), 1);
|
||||
assert.strictEqual(psc.getPrefixSum(3), 1);
|
||||
assert.strictEqual(psc.getPrefixSum(4), 4);
|
||||
indexOfResult = psc.getIndexOf(0);
|
||||
assert.strictEqual(indexOfResult.index, 0);
|
||||
assert.strictEqual(indexOfResult.remainder, 0);
|
||||
|
@ -154,12 +154,12 @@ suite('Editor ViewModel - PrefixSumComputer', () => {
|
|||
psc.changeValue(1, 1);
|
||||
psc.changeValue(3, 1);
|
||||
psc.changeValue(4, 1);
|
||||
assert.strictEqual(psc.getTotalValue(), 4);
|
||||
assert.strictEqual(psc.getAccumulatedValue(0), 1);
|
||||
assert.strictEqual(psc.getAccumulatedValue(1), 2);
|
||||
assert.strictEqual(psc.getAccumulatedValue(2), 2);
|
||||
assert.strictEqual(psc.getAccumulatedValue(3), 3);
|
||||
assert.strictEqual(psc.getAccumulatedValue(4), 4);
|
||||
assert.strictEqual(psc.getTotalSum(), 4);
|
||||
assert.strictEqual(psc.getPrefixSum(0), 1);
|
||||
assert.strictEqual(psc.getPrefixSum(1), 2);
|
||||
assert.strictEqual(psc.getPrefixSum(2), 2);
|
||||
assert.strictEqual(psc.getPrefixSum(3), 3);
|
||||
assert.strictEqual(psc.getPrefixSum(4), 4);
|
||||
indexOfResult = psc.getIndexOf(0);
|
||||
assert.strictEqual(indexOfResult.index, 0);
|
||||
assert.strictEqual(indexOfResult.remainder, 0);
|
||||
|
|
|
@ -143,7 +143,7 @@ export class ExtHostDocumentData extends MirrorTextModel {
|
|||
private _offsetAt(position: vscode.Position): number {
|
||||
position = this._validatePosition(position);
|
||||
this._ensureLineStarts();
|
||||
return this._lineStarts!.getAccumulatedValue(position.line - 1) + position.character;
|
||||
return this._lineStarts!.getPrefixSum(position.line - 1) + position.character;
|
||||
}
|
||||
|
||||
private _positionAt(offset: number): vscode.Position {
|
||||
|
|
|
@ -123,7 +123,7 @@ export class ExtHostNotebookConcatDocument implements vscode.NotebookConcatTextD
|
|||
|
||||
offsetAt(position: vscode.Position): number {
|
||||
const idx = this._cellLines.getIndexOf(position.line);
|
||||
const offset1 = this._cellLengths.getAccumulatedValue(idx.index - 1);
|
||||
const offset1 = this._cellLengths.getPrefixSum(idx.index - 1);
|
||||
const offset2 = this._cells[idx.index].document.offsetAt(position.with(idx.remainder));
|
||||
return offset1 + offset2;
|
||||
}
|
||||
|
@ -131,13 +131,13 @@ export class ExtHostNotebookConcatDocument implements vscode.NotebookConcatTextD
|
|||
positionAt(locationOrOffset: vscode.Location | number): vscode.Position {
|
||||
if (typeof locationOrOffset === 'number') {
|
||||
const idx = this._cellLengths.getIndexOf(locationOrOffset);
|
||||
const lineCount = this._cellLines.getAccumulatedValue(idx.index - 1);
|
||||
const lineCount = this._cellLines.getPrefixSum(idx.index - 1);
|
||||
return this._cells[idx.index].document.positionAt(idx.remainder).translate(lineCount);
|
||||
}
|
||||
|
||||
const idx = this._cellUris.get(locationOrOffset.uri);
|
||||
if (idx !== undefined) {
|
||||
const line = this._cellLines.getAccumulatedValue(idx - 1);
|
||||
const line = this._cellLines.getPrefixSum(idx - 1);
|
||||
return new types.Position(line + locationOrOffset.range.start.line, locationOrOffset.range.start.character);
|
||||
}
|
||||
// do better?
|
||||
|
@ -180,7 +180,7 @@ export class ExtHostNotebookConcatDocument implements vscode.NotebookConcatTextD
|
|||
const cellPosition = new types.Position(startIdx.remainder, position.character);
|
||||
const validCellPosition = this._cells[startIdx.index].document.validatePosition(cellPosition);
|
||||
|
||||
const line = this._cellLines.getAccumulatedValue(startIdx.index - 1);
|
||||
const line = this._cellLines.getPrefixSum(startIdx.index - 1);
|
||||
return new types.Position(line + validCellPosition.line, validCellPosition.character);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ export class FindModel extends Disposable {
|
|||
} else {
|
||||
// const currIndex = this._findMatchesStarts!.getIndexOf(this._currentMatch);
|
||||
// currCell = this._findMatches[currIndex.index].cell;
|
||||
const totalVal = this._findMatchesStarts.getTotalValue();
|
||||
const totalVal = this._findMatchesStarts.getTotalSum();
|
||||
if (this._currentMatch === -1) {
|
||||
this._currentMatch = previous ? totalVal - 1 : 0;
|
||||
} else {
|
||||
|
|
|
@ -109,7 +109,7 @@ export class DiffNestedCellViewModel extends Disposable implements IDiffNestedCe
|
|||
throw new Error('Output index out of range!');
|
||||
}
|
||||
|
||||
return this._outputsTop!.getAccumulatedValue(index - 1);
|
||||
return this._outputsTop!.getPrefixSum(index - 1);
|
||||
}
|
||||
|
||||
updateOutputHeight(index: number, height: number): void {
|
||||
|
@ -127,6 +127,6 @@ export class DiffNestedCellViewModel extends Disposable implements IDiffNestedCe
|
|||
getOutputTotalHeight() {
|
||||
this._ensureOutputsTop();
|
||||
|
||||
return this._outputsTop?.getTotalValue() ?? 0;
|
||||
return this._outputsTop?.getTotalSum() ?? 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -469,7 +469,7 @@ export class NotebookCellList extends WorkbenchList<CellViewModel> implements ID
|
|||
return viewIndex;
|
||||
}
|
||||
|
||||
const modelIndex = this.hiddenRangesPrefixSum.getAccumulatedValue(viewIndex - 1);
|
||||
const modelIndex = this.hiddenRangesPrefixSum.getPrefixSum(viewIndex - 1);
|
||||
return modelIndex;
|
||||
}
|
||||
|
||||
|
@ -486,9 +486,9 @@ export class NotebookCellList extends WorkbenchList<CellViewModel> implements ID
|
|||
const viewIndexInfo = this.hiddenRangesPrefixSum.getIndexOf(modelIndex);
|
||||
|
||||
if (viewIndexInfo.remainder !== 0) {
|
||||
if (modelIndex >= this.hiddenRangesPrefixSum.getTotalValue()) {
|
||||
if (modelIndex >= this.hiddenRangesPrefixSum.getTotalSum()) {
|
||||
// it's already after the last hidden range
|
||||
return modelIndex - (this.hiddenRangesPrefixSum.getTotalValue() - this.hiddenRangesPrefixSum.getCount());
|
||||
return modelIndex - (this.hiddenRangesPrefixSum.getTotalSum() - this.hiddenRangesPrefixSum.getCount());
|
||||
}
|
||||
return undefined;
|
||||
} else {
|
||||
|
@ -504,7 +504,7 @@ export class NotebookCellList extends WorkbenchList<CellViewModel> implements ID
|
|||
let modelIndex = topModelIndex;
|
||||
|
||||
while (index <= bottomViewIndex) {
|
||||
const accu = this.hiddenRangesPrefixSum!.getAccumulatedValue(index);
|
||||
const accu = this.hiddenRangesPrefixSum!.getPrefixSum(index);
|
||||
if (accu === modelIndex + 1) {
|
||||
// no hidden area after it
|
||||
if (stack.length) {
|
||||
|
@ -575,8 +575,8 @@ export class NotebookCellList extends WorkbenchList<CellViewModel> implements ID
|
|||
const viewIndexInfo = this.hiddenRangesPrefixSum.getIndexOf(modelIndex);
|
||||
|
||||
if (viewIndexInfo.remainder !== 0) {
|
||||
if (modelIndex >= this.hiddenRangesPrefixSum.getTotalValue()) {
|
||||
return modelIndex - (this.hiddenRangesPrefixSum.getTotalValue() - this.hiddenRangesPrefixSum.getCount());
|
||||
if (modelIndex >= this.hiddenRangesPrefixSum.getTotalSum()) {
|
||||
return modelIndex - (this.hiddenRangesPrefixSum.getTotalSum() - this.hiddenRangesPrefixSum.getCount());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -591,8 +591,8 @@ export class NotebookCellList extends WorkbenchList<CellViewModel> implements ID
|
|||
const viewIndexInfo = this.hiddenRangesPrefixSum.getIndexOf(modelIndex);
|
||||
|
||||
if (viewIndexInfo.remainder !== 0) {
|
||||
if (modelIndex >= this.hiddenRangesPrefixSum.getTotalValue()) {
|
||||
return modelIndex - (this.hiddenRangesPrefixSum.getTotalValue() - this.hiddenRangesPrefixSum.getCount());
|
||||
if (modelIndex >= this.hiddenRangesPrefixSum.getTotalSum()) {
|
||||
return modelIndex - (this.hiddenRangesPrefixSum.getTotalSum() - this.hiddenRangesPrefixSum.getCount());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -159,7 +159,7 @@ export class CodeCellViewModel extends BaseCellViewModel implements ICellViewMod
|
|||
const notebookLayoutConfiguration = this.viewContext.notebookOptions.getLayoutConfiguration();
|
||||
const bottomToolbarDimensions = this.viewContext.notebookOptions.computeBottomToolbarDimensions();
|
||||
const outputShowMoreContainerHeight = state.outputShowMoreContainerHeight ? state.outputShowMoreContainerHeight : this._layoutInfo.outputShowMoreContainerHeight;
|
||||
let outputTotalHeight = Math.max(this._outputMinHeight, this.metadata.outputCollapsed ? notebookLayoutConfiguration.collapsedIndicatorHeight : this._outputsTop!.getTotalValue());
|
||||
let outputTotalHeight = Math.max(this._outputMinHeight, this.metadata.outputCollapsed ? notebookLayoutConfiguration.collapsedIndicatorHeight : this._outputsTop!.getTotalSum());
|
||||
|
||||
const originalLayout = this.layoutInfo;
|
||||
if (!this.metadata.inputCollapsed) {
|
||||
|
@ -368,7 +368,7 @@ export class CodeCellViewModel extends BaseCellViewModel implements ICellViewMod
|
|||
throw new Error('Output index out of range!');
|
||||
}
|
||||
|
||||
return this._outputsTop!.getAccumulatedValue(index - 1);
|
||||
return this._outputsTop!.getPrefixSum(index - 1);
|
||||
}
|
||||
|
||||
getOutputOffset(index: number): number {
|
||||
|
|
Loading…
Reference in a new issue