1
>
/*---------------------------------------------------------------------------------------------
editStack.ts
2
>
* Copyright (c) Microsoft Corporation. All rights reserved.
3
>
* Licensed under the MIT License. See License.txt in the project root for license information.
4
>
*--------------------------------------------------------------------------------------------*/
5
>
6
>
import * as nls from '../../../nls.js';
7
>
import { onUnexpectedError } from '../../../base/common/errors.js';
8
>
import { Selection } from '../core/selection.js';
9
>
import { EndOfLineSequence, ICursorStateComputer, IValidEditOperation, ITextModel } from '../model.js';
10
>
import { TextModel } from './textModel.js';
11
>
import { IUndoRedoService, IResourceUndoRedoElement, UndoRedoElementType, IWorkspaceUndoRedoElement, UndoRedoGroup } from '../../../platform/undoRedo/common/undoRedo.js';
12
>
import { URI } from '../../../base/common/uri.js';
13
>
import { TextChange, compressConsecutiveTextChanges } from '../core/textChange.js';
14
>
import * as buffer from '../../../base/common/buffer.js';
15
>
import { IDisposable } from '../../../base/common/lifecycle.js';
16
>
import { basename } from '../../../base/common/resources.js';
17
>
import { ISingleEditOperation } from '../core/editOperation.js';
18
>
import { EditSources, TextModelEditSource } from '../textModelEditSource.js';
19
>
20
function uriGetComparisonKey(resource: URI): string {
21
return resource.toString();
22
}
24
>
export class SingleModelEditStackData {
25
>
26
>
public static create(model: ITextModel, beforeCursorState: Selection[] | null): SingleModelEditStackData {
27
>
const alternativeVersionId = model.getAlternativeVersionId();
28
>
const eol = getModelEOL(model);
29
>
return new SingleModelEditStackData(
30
>
alternativeVersionId,
31
>
alternativeVersionId,
32
>
eol,
33
>
eol,
34
>
beforeCursorState,
35
>
beforeCursorState,
36
>
[]
37
>
);
38
>
}
39
>
40
>
constructor(
41
public readonly beforeVersionId: number,
42
public afterVersionId: number,