mirror of
https://github.com/microsoft/vscode.git
synced 2026-09-20 19:14:10 +01:00
Restrict usages of new ModelLine (#30180)
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
import { Range, IRange } from 'vs/editor/common/core/range';
|
||||
import * as editorCommon from 'vs/editor/common/editorCommon';
|
||||
import { EditStack } from 'vs/editor/common/model/editStack';
|
||||
import { ILineEdit, LineMarker, ModelLine, MarkersTracker, IModelLine } from 'vs/editor/common/model/modelLine';
|
||||
import { ILineEdit, LineMarker, MarkersTracker, IModelLine } from 'vs/editor/common/model/modelLine';
|
||||
import { TextModelWithDecorations, ModelDecorationOptions } from 'vs/editor/common/model/textModelWithDecorations';
|
||||
import * as strings from 'vs/base/common/strings';
|
||||
import * as arrays from 'vs/base/common/arrays';
|
||||
@@ -653,7 +653,7 @@ export class EditableTextModel extends TextModelWithDecorations implements edito
|
||||
let newLinesContent: string[] = [];
|
||||
let newLinesLengths = new Uint32Array(insertingLinesCnt - editingLinesCnt);
|
||||
for (let j = editingLinesCnt + 1; j <= insertingLinesCnt; j++) {
|
||||
newLines.push(new ModelLine(op.lines[j], tabSize));
|
||||
newLines.push(this._createModelLine(op.lines[j], tabSize));
|
||||
newLinesContent.push(op.lines[j]);
|
||||
newLinesLengths[j - editingLinesCnt - 1] = op.lines[j].length + this._EOL.length;
|
||||
}
|
||||
|
||||
@@ -115,6 +115,10 @@ export class TextModel implements editorCommon.ITextModel {
|
||||
this._isDisposing = false;
|
||||
}
|
||||
|
||||
protected _createModelLine(text: string, tabSize: number): IModelLine {
|
||||
return new ModelLine(text, tabSize);
|
||||
}
|
||||
|
||||
protected _assertNotDisposed(): void {
|
||||
if (this._isDisposed) {
|
||||
throw new Error('Model is disposed!');
|
||||
@@ -758,7 +762,7 @@ export class TextModel implements editorCommon.ITextModel {
|
||||
let modelLines: IModelLine[] = [];
|
||||
|
||||
for (let i = 0, len = rawLines.length; i < len; i++) {
|
||||
modelLines[i] = new ModelLine(rawLines[i], tabSize);
|
||||
modelLines[i] = this._createModelLine(rawLines[i], tabSize);
|
||||
}
|
||||
this._BOM = textSource.BOM;
|
||||
this._mightContainRTL = textSource.containsRTL;
|
||||
|
||||
Reference in New Issue
Block a user