55
linesLayout._commitPendingChanges(inserts, changes, removes);
56
}
58
>
59
>
export class EditorWhitespace implements IEditorWhitespace {
60
>
public id: string;
61
>
public afterLineNumber: number;
62
>
public ordinal: number;
63
>
public height: number;
64
>
public minWidth: number;
65
>
public prefixSum: number;
66
>
67
>
constructor(id: string, afterLineNumber: number, ordinal: number, height: number, minWidth: number) {
68
>
this.id = id;
69
>
this.afterLineNumber = afterLineNumber;
70
>
this.ordinal = ordinal;
71
>
this.height = height;
72
>
this.minWidth = minWidth;
73
>
this.prefixSum = 0;
74
>
}
75
>
}
76
>
77
>
/**
78
>
* Layouting of objects that take vertical space (by having a height) and push down other objects.
79
>
*
80
>
* These objects are basically either text (lines) or spaces between those lines (whitespaces).
81
>
* This provides commodity operations for working with lines that contain whitespace that pushes lines lower (vertically).
82
>
*/
83
>
export class LinesLayout {
84
>
85
>
private static INSTANCE_COUNT = 0;
86
>
87
>
private readonly _instanceId: string;
88
>
private readonly _pendingChanges: PendingChanges;
89
>
private _lastWhitespaceId: number;
90
>
private _arr: EditorWhitespace[];
91
>
private _prefixSumValidIndex: number;
92
>
private _minWidth: number;
93
>
private _lineCount: number;
94
>
private _paddingTop: number;
95
>
private _paddingBottom: number;
96
>
private _lineHeightsManager: LineHeightsManager;
97
>
98
>
constructor(lineCount: number, defaultLineHeight: number, paddingTop: number, paddingBottom: number, customLineHeightData: CustomLineHeightData[]) {
99
this._instanceId = strings.singleLetterHash(++LinesLayout.INSTANCE_COUNT);
100
this._pendingChanges = new PendingChanges();