@lvce-editor/editor-worker 19.77.9 → 19.77.11
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 +11 -2
- package/dist/editorWorkerMain.js +11 -2
- 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;
|
|
@@ -9958,6 +9963,10 @@ const wrapCommand$1 = (fn, preservesTypingCoalescing = false, returnState = true
|
|
|
9958
9963
|
uri
|
|
9959
9964
|
} = state;
|
|
9960
9965
|
const commandResult = await fn(state, ...args);
|
|
9966
|
+
// A command with no update must leave the current editor state intact.
|
|
9967
|
+
if (commandResult === undefined) {
|
|
9968
|
+
return returnState ? state : undefined;
|
|
9969
|
+
}
|
|
9961
9970
|
const shouldFormatAfterSave = commandResult?.postSaveFormat === true;
|
|
9962
9971
|
let newEditor = !preservesTypingCoalescing && commandResult.canCoalesceTyping ? {
|
|
9963
9972
|
...commandResult,
|
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;
|
|
@@ -10378,6 +10383,10 @@ const wrapCommand$1 = (fn, preservesTypingCoalescing = false, returnState = true
|
|
|
10378
10383
|
uri
|
|
10379
10384
|
} = state;
|
|
10380
10385
|
const commandResult = await fn(state, ...args);
|
|
10386
|
+
// A command with no update must leave the current editor state intact.
|
|
10387
|
+
if (commandResult === undefined) {
|
|
10388
|
+
return returnState ? state : undefined;
|
|
10389
|
+
}
|
|
10381
10390
|
const shouldFormatAfterSave = commandResult?.postSaveFormat === true;
|
|
10382
10391
|
let newEditor = !preservesTypingCoalescing && commandResult.canCoalesceTyping ? {
|
|
10383
10392
|
...commandResult,
|