@lvce-editor/editor-worker 19.77.8 → 19.77.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/diff-sdk.js +19 -8
- package/dist/editorWorkerMain.js +19 -8
- package/package.json +1 -1
package/dist/diff-sdk.js
CHANGED
|
@@ -2240,7 +2240,11 @@ const getCharacterWidth = (line, start, end, tabSize) => {
|
|
|
2240
2240
|
// Treat each cluster as one display column; the extra cluster below is a safe overscan.
|
|
2241
2241
|
return 1;
|
|
2242
2242
|
};
|
|
2243
|
-
const getHorizontalDisplayColumn = (line, sourceColumn, tabSize,
|
|
2243
|
+
const getHorizontalDisplayColumn = (line, sourceColumn, tabSize, suppliedSegments) => {
|
|
2244
|
+
if (sourceColumn <= 0) {
|
|
2245
|
+
return 0;
|
|
2246
|
+
}
|
|
2247
|
+
const segments = suppliedSegments ?? getSegments(line);
|
|
2244
2248
|
let displayColumn = 0;
|
|
2245
2249
|
for (let i = 0; i < segments.length - 1; i++) {
|
|
2246
2250
|
const start = segments[i];
|
|
@@ -2252,13 +2256,14 @@ const getHorizontalDisplayColumn = (line, sourceColumn, tabSize, segments = getS
|
|
|
2252
2256
|
}
|
|
2253
2257
|
return displayColumn;
|
|
2254
2258
|
};
|
|
2255
|
-
const getHorizontalVisibleRange = (line, deltaX, width, averageCharWidth, tabSize, threshold = defaultThreshold,
|
|
2259
|
+
const getHorizontalVisibleRange = (line, deltaX, width, averageCharWidth, tabSize, threshold = defaultThreshold, suppliedSegments) => {
|
|
2256
2260
|
if (line.length <= threshold) {
|
|
2257
2261
|
return {
|
|
2258
2262
|
end: line.length,
|
|
2259
2263
|
start: 0
|
|
2260
2264
|
};
|
|
2261
2265
|
}
|
|
2266
|
+
const segments = suppliedSegments ?? getSegments(line);
|
|
2262
2267
|
const charWidth = averageCharWidth > 0 ? averageCharWidth : 1;
|
|
2263
2268
|
const scrollOffset = Math.max(0, Number.isFinite(deltaX) ? deltaX : 0);
|
|
2264
2269
|
const viewportWidth = Number.isFinite(width) ? Math.max(0, width) : Infinity;
|
|
@@ -6271,7 +6276,7 @@ const updateLines = (editor, lines) => {
|
|
|
6271
6276
|
* @param {Uint32Array|undefined} selectionChanges
|
|
6272
6277
|
* @returns
|
|
6273
6278
|
*/
|
|
6274
|
-
const scheduleDocumentAndCursorsSelections = async (editor, changes, selectionChanges = undefined) => {
|
|
6279
|
+
const scheduleDocumentAndCursorsSelections = async (editor, changes, selectionChanges = undefined, options = {}) => {
|
|
6275
6280
|
object(editor);
|
|
6276
6281
|
array(changes);
|
|
6277
6282
|
if (changes.length === 0) {
|
|
@@ -6327,7 +6332,7 @@ const scheduleDocumentAndCursorsSelections = async (editor, changes, selectionCh
|
|
|
6327
6332
|
set$b(editor.uid, editor, newEditorWithDecorations);
|
|
6328
6333
|
|
|
6329
6334
|
// Notify main-area-worker about modified status change
|
|
6330
|
-
if (!editor.modified) {
|
|
6335
|
+
if (!editor.modified && options.notifyModifiedStatusChange !== false) {
|
|
6331
6336
|
await notifyTabModifiedStatusChange(editor.uri, true, editor.applicationId);
|
|
6332
6337
|
}
|
|
6333
6338
|
|
|
@@ -9333,7 +9338,7 @@ const error = (...args) => {
|
|
|
9333
9338
|
console.error(...args);
|
|
9334
9339
|
};
|
|
9335
9340
|
|
|
9336
|
-
const applyDocumentEdits$1 = (editor, edits) => {
|
|
9341
|
+
const applyDocumentEdits$1 = (editor, edits, options = {}) => {
|
|
9337
9342
|
if (!Array.isArray(edits)) {
|
|
9338
9343
|
warn('something is wrong with format on save', edits);
|
|
9339
9344
|
return editor;
|
|
@@ -9346,7 +9351,7 @@ const applyDocumentEdits$1 = (editor, edits) => {
|
|
|
9346
9351
|
...editor
|
|
9347
9352
|
}, documentEdits);
|
|
9348
9353
|
const selections = getFormattingSelections(editor.lines, newLines, editor.selections);
|
|
9349
|
-
return scheduleDocumentAndCursorsSelections(editor, documentEdits, selections);
|
|
9354
|
+
return scheduleDocumentAndCursorsSelections(editor, documentEdits, selections, options);
|
|
9350
9355
|
};
|
|
9351
9356
|
|
|
9352
9357
|
const applyEdit = async (editor, changes, selectionChanges) => {
|
|
@@ -9879,11 +9884,17 @@ const formatAfterSave = async (uid, snapshot) => {
|
|
|
9879
9884
|
if (staleReason) {
|
|
9880
9885
|
return editor;
|
|
9881
9886
|
}
|
|
9882
|
-
const formattedEditor = await applyDocumentEdits$1(editor, edits
|
|
9887
|
+
const formattedEditor = await applyDocumentEdits$1(editor, edits, {
|
|
9888
|
+
notifyModifiedStatusChange: false
|
|
9889
|
+
});
|
|
9883
9890
|
if (formattedEditor === editor || getText$1(formattedEditor) === originalText) {
|
|
9884
9891
|
return editor;
|
|
9885
9892
|
}
|
|
9886
|
-
|
|
9893
|
+
const savedEditor = await save$1(formattedEditor, true);
|
|
9894
|
+
if (savedEditor === formattedEditor) {
|
|
9895
|
+
await notifyTabModifiedStatusChange(editor.uri, true, editor.applicationId);
|
|
9896
|
+
}
|
|
9897
|
+
return savedEditor;
|
|
9887
9898
|
});
|
|
9888
9899
|
await applyFormatting(uid);
|
|
9889
9900
|
};
|
package/dist/editorWorkerMain.js
CHANGED
|
@@ -3606,7 +3606,11 @@ const getCharacterWidth = (line, start, end, tabSize) => {
|
|
|
3606
3606
|
// Treat each cluster as one display column; the extra cluster below is a safe overscan.
|
|
3607
3607
|
return 1;
|
|
3608
3608
|
};
|
|
3609
|
-
const getHorizontalDisplayColumn = (line, sourceColumn, tabSize,
|
|
3609
|
+
const getHorizontalDisplayColumn = (line, sourceColumn, tabSize, suppliedSegments) => {
|
|
3610
|
+
if (sourceColumn <= 0) {
|
|
3611
|
+
return 0;
|
|
3612
|
+
}
|
|
3613
|
+
const segments = suppliedSegments ?? getSegments(line);
|
|
3610
3614
|
let displayColumn = 0;
|
|
3611
3615
|
for (let i = 0; i < segments.length - 1; i++) {
|
|
3612
3616
|
const start = segments[i];
|
|
@@ -3618,13 +3622,14 @@ const getHorizontalDisplayColumn = (line, sourceColumn, tabSize, segments = getS
|
|
|
3618
3622
|
}
|
|
3619
3623
|
return displayColumn;
|
|
3620
3624
|
};
|
|
3621
|
-
const getHorizontalVisibleRange = (line, deltaX, width, averageCharWidth, tabSize, threshold = defaultThreshold,
|
|
3625
|
+
const getHorizontalVisibleRange = (line, deltaX, width, averageCharWidth, tabSize, threshold = defaultThreshold, suppliedSegments) => {
|
|
3622
3626
|
if (line.length <= threshold) {
|
|
3623
3627
|
return {
|
|
3624
3628
|
end: line.length,
|
|
3625
3629
|
start: 0
|
|
3626
3630
|
};
|
|
3627
3631
|
}
|
|
3632
|
+
const segments = suppliedSegments ?? getSegments(line);
|
|
3628
3633
|
const charWidth = averageCharWidth > 0 ? averageCharWidth : 1;
|
|
3629
3634
|
const scrollOffset = Math.max(0, Number.isFinite(deltaX) ? deltaX : 0);
|
|
3630
3635
|
const viewportWidth = Number.isFinite(width) ? Math.max(0, width) : Infinity;
|
|
@@ -6696,7 +6701,7 @@ const updateLines = (editor, lines) => {
|
|
|
6696
6701
|
* @param {Uint32Array|undefined} selectionChanges
|
|
6697
6702
|
* @returns
|
|
6698
6703
|
*/
|
|
6699
|
-
const scheduleDocumentAndCursorsSelections = async (editor, changes, selectionChanges = undefined) => {
|
|
6704
|
+
const scheduleDocumentAndCursorsSelections = async (editor, changes, selectionChanges = undefined, options = {}) => {
|
|
6700
6705
|
object(editor);
|
|
6701
6706
|
array(changes);
|
|
6702
6707
|
if (changes.length === 0) {
|
|
@@ -6752,7 +6757,7 @@ const scheduleDocumentAndCursorsSelections = async (editor, changes, selectionCh
|
|
|
6752
6757
|
set$b(editor.uid, editor, newEditorWithDecorations);
|
|
6753
6758
|
|
|
6754
6759
|
// Notify main-area-worker about modified status change
|
|
6755
|
-
if (!editor.modified) {
|
|
6760
|
+
if (!editor.modified && options.notifyModifiedStatusChange !== false) {
|
|
6756
6761
|
await notifyTabModifiedStatusChange(editor.uri, true, editor.applicationId);
|
|
6757
6762
|
}
|
|
6758
6763
|
|
|
@@ -9758,7 +9763,7 @@ const error = (...args) => {
|
|
|
9758
9763
|
console.error(...args);
|
|
9759
9764
|
};
|
|
9760
9765
|
|
|
9761
|
-
const applyDocumentEdits$1 = (editor, edits) => {
|
|
9766
|
+
const applyDocumentEdits$1 = (editor, edits, options = {}) => {
|
|
9762
9767
|
if (!Array.isArray(edits)) {
|
|
9763
9768
|
warn('something is wrong with format on save', edits);
|
|
9764
9769
|
return editor;
|
|
@@ -9771,7 +9776,7 @@ const applyDocumentEdits$1 = (editor, edits) => {
|
|
|
9771
9776
|
...editor
|
|
9772
9777
|
}, documentEdits);
|
|
9773
9778
|
const selections = getFormattingSelections(editor.lines, newLines, editor.selections);
|
|
9774
|
-
return scheduleDocumentAndCursorsSelections(editor, documentEdits, selections);
|
|
9779
|
+
return scheduleDocumentAndCursorsSelections(editor, documentEdits, selections, options);
|
|
9775
9780
|
};
|
|
9776
9781
|
|
|
9777
9782
|
const applyEdit = async (editor, changes, selectionChanges) => {
|
|
@@ -10299,11 +10304,17 @@ const formatAfterSave = async (uid, snapshot) => {
|
|
|
10299
10304
|
if (staleReason) {
|
|
10300
10305
|
return editor;
|
|
10301
10306
|
}
|
|
10302
|
-
const formattedEditor = await applyDocumentEdits$1(editor, edits
|
|
10307
|
+
const formattedEditor = await applyDocumentEdits$1(editor, edits, {
|
|
10308
|
+
notifyModifiedStatusChange: false
|
|
10309
|
+
});
|
|
10303
10310
|
if (formattedEditor === editor || getText$1(formattedEditor) === originalText) {
|
|
10304
10311
|
return editor;
|
|
10305
10312
|
}
|
|
10306
|
-
|
|
10313
|
+
const savedEditor = await save$1(formattedEditor, true);
|
|
10314
|
+
if (savedEditor === formattedEditor) {
|
|
10315
|
+
await notifyTabModifiedStatusChange(editor.uri, true, editor.applicationId);
|
|
10316
|
+
}
|
|
10317
|
+
return savedEditor;
|
|
10307
10318
|
});
|
|
10308
10319
|
await applyFormatting(uid);
|
|
10309
10320
|
};
|