@lvce-editor/editor-worker 19.30.4 → 19.30.6
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/editorWorkerMain.js +19 -20
- package/package.json +1 -1
package/dist/editorWorkerMain.js
CHANGED
|
@@ -4064,6 +4064,8 @@ const setSelections$2 = (editor, selections) => {
|
|
|
4064
4064
|
const {
|
|
4065
4065
|
foldingRanges = []
|
|
4066
4066
|
} = editor;
|
|
4067
|
+
const primarySelectionIndex = editor.primarySelectionIndex || 0;
|
|
4068
|
+
const activeRowIndex = selections[primarySelectionIndex + 2];
|
|
4067
4069
|
if ('foldingRanges' in editor) {
|
|
4068
4070
|
const normalizedSelections = foldingRanges.length === 0 ? selections : map(selections, (result, index, startRow, startColumn, endRow, endColumn) => {
|
|
4069
4071
|
const previousRow = editor.selections[index + 2] ?? endRow;
|
|
@@ -4072,7 +4074,8 @@ const setSelections$2 = (editor, selections) => {
|
|
|
4072
4074
|
result[index + 2] = getUnhiddenRow(endRow, previousRow, editor.lines.length, foldingRanges);
|
|
4073
4075
|
result[index + 3] = endColumn;
|
|
4074
4076
|
});
|
|
4075
|
-
const
|
|
4077
|
+
const previousActiveRowIndex = editor.selections[primarySelectionIndex + 2] ?? activeRowIndex;
|
|
4078
|
+
const rowIndex = getUnhiddenRow(activeRowIndex, previousActiveRowIndex, editor.lines.length, foldingRanges);
|
|
4076
4079
|
const visualRow = getVisualRowForDocumentRow(rowIndex, foldingRanges);
|
|
4077
4080
|
const startVisualRow = Math.floor(editor.deltaY / editor.itemHeight);
|
|
4078
4081
|
const endVisualRow = startVisualRow + editor.numberOfVisibleLines;
|
|
@@ -4098,10 +4101,10 @@ const setSelections$2 = (editor, selections) => {
|
|
|
4098
4101
|
minLineY,
|
|
4099
4102
|
numberOfVisibleLines
|
|
4100
4103
|
} = editor;
|
|
4101
|
-
if (maxLineY === undefined || minLineY === undefined || numberOfVisibleLines <= 0) {
|
|
4104
|
+
if (maxLineY === undefined || minLineY === undefined || numberOfVisibleLines === undefined || numberOfVisibleLines <= 0) {
|
|
4102
4105
|
return newEditor;
|
|
4103
4106
|
}
|
|
4104
|
-
const rowIndex =
|
|
4107
|
+
const rowIndex = activeRowIndex;
|
|
4105
4108
|
if (rowIndex === undefined) {
|
|
4106
4109
|
return newEditor;
|
|
4107
4110
|
}
|
|
@@ -9660,15 +9663,14 @@ const selectCharacterRight = editor => {
|
|
|
9660
9663
|
// @ts-ignore
|
|
9661
9664
|
|
|
9662
9665
|
// @ts-ignore
|
|
9663
|
-
const
|
|
9666
|
+
const getSelectDownChanges = (lines, selections) => {
|
|
9664
9667
|
const max = lines.length - 1;
|
|
9665
9668
|
const newSelections = new Uint32Array(selections.length);
|
|
9666
9669
|
for (let i = 0; i < selections.length; i += 4) {
|
|
9667
|
-
|
|
9668
|
-
newSelections[i] =
|
|
9669
|
-
newSelections[i +
|
|
9670
|
-
newSelections[i +
|
|
9671
|
-
newSelections[i + 3] = selectionEndColumn;
|
|
9670
|
+
newSelections[i] = selections[i];
|
|
9671
|
+
newSelections[i + 1] = selections[i + 1];
|
|
9672
|
+
newSelections[i + 2] = Math.min(selections[i + 2] + 1, max);
|
|
9673
|
+
newSelections[i + 3] = selections[i + 3];
|
|
9672
9674
|
}
|
|
9673
9675
|
return newSelections;
|
|
9674
9676
|
};
|
|
@@ -9679,7 +9681,7 @@ const selectDown = editor => {
|
|
|
9679
9681
|
lines,
|
|
9680
9682
|
selections
|
|
9681
9683
|
} = editor;
|
|
9682
|
-
const newSelections =
|
|
9684
|
+
const newSelections = getSelectDownChanges(lines, selections);
|
|
9683
9685
|
return scheduleSelections(editor, newSelections);
|
|
9684
9686
|
};
|
|
9685
9687
|
|
|
@@ -9933,14 +9935,13 @@ const selectPreviousOccurrence = editor => {
|
|
|
9933
9935
|
// @ts-ignore
|
|
9934
9936
|
|
|
9935
9937
|
// @ts-ignore
|
|
9936
|
-
const getSelectUpChanges =
|
|
9938
|
+
const getSelectUpChanges = selections => {
|
|
9937
9939
|
const newSelections = new Uint32Array(selections.length);
|
|
9938
9940
|
for (let i = 0; i < selections.length; i += 4) {
|
|
9939
|
-
|
|
9940
|
-
newSelections[i] =
|
|
9941
|
-
newSelections[i +
|
|
9942
|
-
newSelections[i +
|
|
9943
|
-
newSelections[i + 3] = selectionEndColumn;
|
|
9941
|
+
newSelections[i] = selections[i];
|
|
9942
|
+
newSelections[i + 1] = selections[i + 1];
|
|
9943
|
+
newSelections[i + 2] = Math.max(selections[i + 2] - 1, 0);
|
|
9944
|
+
newSelections[i + 3] = selections[i + 3];
|
|
9944
9945
|
}
|
|
9945
9946
|
return newSelections;
|
|
9946
9947
|
};
|
|
@@ -9948,10 +9949,9 @@ const getSelectUpChanges = (lines, selections) => {
|
|
|
9948
9949
|
// @ts-ignore
|
|
9949
9950
|
const selectUp = editor => {
|
|
9950
9951
|
const {
|
|
9951
|
-
lines,
|
|
9952
9952
|
selections
|
|
9953
9953
|
} = editor;
|
|
9954
|
-
const newSelections = getSelectUpChanges(
|
|
9954
|
+
const newSelections = getSelectUpChanges(selections);
|
|
9955
9955
|
return scheduleSelections(editor, newSelections);
|
|
9956
9956
|
};
|
|
9957
9957
|
|
|
@@ -13894,8 +13894,7 @@ const editorDiagnosticEffect = {
|
|
|
13894
13894
|
apply(editor) {
|
|
13895
13895
|
return updateDiagnostics(editor);
|
|
13896
13896
|
},
|
|
13897
|
-
|
|
13898
|
-
isActive: (oldEditor, newEditor) => newEditor.diagnosticsEnabled && JSON.stringify(oldEditor.lines) !== JSON.stringify(newEditor.lines)
|
|
13897
|
+
isActive: (oldEditor, newEditor) => newEditor.diagnosticsEnabled && oldEditor.lines !== newEditor.lines
|
|
13899
13898
|
};
|
|
13900
13899
|
|
|
13901
13900
|
const queues = {};
|