@openclaw/diffs 2026.9.1 → 2026.9.2
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/index.js +6 -5
- package/node_modules/@pierre/diffs/dist/editor/editor.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/editor/editor.js +97 -24
- package/node_modules/@pierre/diffs/dist/editor/editor.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/editor/searchPanel.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/editor/searchPanel.js +2 -1
- package/node_modules/@pierre/diffs/dist/editor/searchPanel.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/editor/selection.d.ts +2 -1
- package/node_modules/@pierre/diffs/dist/editor/selection.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/editor/selection.js +1 -1
- package/node_modules/@pierre/diffs/dist/editor/selection.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/editor/tokenizer.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/editor/tokenizer.js +6 -3
- package/node_modules/@pierre/diffs/dist/editor/tokenizer.js.map +1 -1
- package/node_modules/@pierre/diffs/package.json +1 -1
- package/node_modules/typebox/build/format/json_pointer.d.mts +2 -2
- package/node_modules/typebox/build/format/json_pointer.mjs +2 -2
- package/node_modules/typebox/build/format/json_pointer_uri_fragment.d.mts +2 -2
- package/node_modules/typebox/build/format/json_pointer_uri_fragment.mjs +2 -2
- package/node_modules/typebox/build/format/relative_json_pointer.d.mts +2 -2
- package/node_modules/typebox/build/format/relative_json_pointer.mjs +2 -2
- package/node_modules/typebox/build/system/memory/assign.mjs +2 -1
- package/node_modules/typebox/build/system/memory/create.mjs +3 -4
- package/node_modules/typebox/build/system/memory/discard.mjs +2 -2
- package/node_modules/typebox/build/system/memory/freeze.d.mts +4 -0
- package/node_modules/typebox/build/system/memory/freeze.mjs +6 -0
- package/node_modules/typebox/build/system/memory/update.mjs +3 -2
- package/node_modules/typebox/package.json +1 -1
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -1646,13 +1646,14 @@ const DiffsToolSchema = Type.Object({
|
|
|
1646
1646
|
baseUrl: Type.Optional(Type.String({ description: "Optional gateway base URL override used when building the viewer URL. Overrides configured viewerBaseUrl, for example https://gateway.example.com." }))
|
|
1647
1647
|
}, { additionalProperties: false });
|
|
1648
1648
|
function createDiffsTool(params) {
|
|
1649
|
-
const loadScreenshotter = async () => params.screenshotter ?? new (await (loadDiffsBrowserRuntime())).PlaywrightDiffScreenshotter({ config
|
|
1649
|
+
const loadScreenshotter = async (config) => params.screenshotter ?? new (await (loadDiffsBrowserRuntime())).PlaywrightDiffScreenshotter({ config });
|
|
1650
1650
|
return {
|
|
1651
1651
|
name: "diffs",
|
|
1652
1652
|
label: "Diffs",
|
|
1653
1653
|
description: "Create a read-only diff viewer from before/after text or a unified patch. Returns a gateway viewer URL for interactive viewing and can also render the same diff to a PNG or PDF.",
|
|
1654
1654
|
parameters: DiffsToolSchema,
|
|
1655
1655
|
execute: async (_toolCallId, rawParams) => {
|
|
1656
|
+
const config = params.getConfig();
|
|
1656
1657
|
const toolParams = asNonArrayRecord(rawParams);
|
|
1657
1658
|
const rawRecord = toolParams;
|
|
1658
1659
|
const artifactContext = buildArtifactContext(params.context);
|
|
@@ -1698,7 +1699,7 @@ function createDiffsTool(params) {
|
|
|
1698
1699
|
});
|
|
1699
1700
|
if (isArtifactOnlyMode(mode)) {
|
|
1700
1701
|
const artifactFile = await renderDiffArtifactFile({
|
|
1701
|
-
screenshotter: await loadScreenshotter(),
|
|
1702
|
+
screenshotter: await loadScreenshotter(config),
|
|
1702
1703
|
store: params.store,
|
|
1703
1704
|
html: requireRenderedHtml(rendered.imageHtml, "image"),
|
|
1704
1705
|
theme,
|
|
@@ -1739,7 +1740,7 @@ function createDiffsTool(params) {
|
|
|
1739
1740
|
context: artifactContext
|
|
1740
1741
|
});
|
|
1741
1742
|
const viewerUrl = buildViewerUrl({
|
|
1742
|
-
config
|
|
1743
|
+
config,
|
|
1743
1744
|
viewerPath: artifact.viewerPath,
|
|
1744
1745
|
baseUrl: normalizeBaseUrl(toolParams.baseUrl),
|
|
1745
1746
|
viewerBaseUrl: params.viewerBaseUrl
|
|
@@ -1765,7 +1766,7 @@ function createDiffsTool(params) {
|
|
|
1765
1766
|
};
|
|
1766
1767
|
try {
|
|
1767
1768
|
const artifactFile = await renderDiffArtifactFile({
|
|
1768
|
-
screenshotter: await loadScreenshotter(),
|
|
1769
|
+
screenshotter: await loadScreenshotter(config),
|
|
1769
1770
|
store: params.store,
|
|
1770
1771
|
html: requireRenderedHtml(rendered.imageHtml, "image"),
|
|
1771
1772
|
theme,
|
|
@@ -1981,7 +1982,7 @@ function registerDiffsPlugin(api) {
|
|
|
1981
1982
|
api.registerTool((ctx) => {
|
|
1982
1983
|
const pluginConfig = resolveCurrentPluginConfig();
|
|
1983
1984
|
return createDiffsTool({
|
|
1984
|
-
api,
|
|
1985
|
+
getConfig: () => ctx.getRuntimeConfig?.() ?? ctx.runtimeConfig ?? ctx.config ?? api.runtime.config.current(),
|
|
1985
1986
|
store,
|
|
1986
1987
|
defaults: resolveDiffsPluginDefaults(pluginConfig),
|
|
1987
1988
|
viewerBaseUrl: resolveDiffsPluginViewerBaseUrl(pluginConfig),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor.d.ts","names":[],"sources":["../../src/editor/editor.ts"],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"editor.d.ts","names":[],"sources":["../../src/editor/editor.ts"],"mappings":";;;;;;;;;UAwMiB,aAAA;;EAEf,iBAAA;EAF4B;EAI5B,MAAA,GAAS,YAAA;EAAA;;;;EAKT,YAAA;EAgCkC;;;;EA3BlC,mBAAA,GAAsB,mBAAA;EAgCiB;EA9BvC,gBAAA;EAkCQ;EAhCR,aAAA;EAkCM;;;;EA7BN,YAAA,GAAe,YAAA;EAgCW;EA9B1B,qBAAA,GAAwB,iBAAA;EAzBK;;;;EA8B7B,sBAAA;EAhBA;;;;;EAsBA,SAAA;IACE,QAAA,GAAW,IAAA,cAAkB,OAAA;EAAA;EAP/B;EAUA,qBAAA,IACE,OAAA,EAAS,sBAAA,CAAuB,WAAA,MAC7B,WAAA;EALH;EAOF,QAAA,IACE,MAAA,EAAQ,MAAA,CAAO,WAAA,GACf,YAAA,EAAc,sBAAA,CAAuB,WAAA;EATR;EAY/B,QAAA,IACE,IAAA,EAAM,YAAA,EACN,eAAA,EACI,cAAA,CAAe,WAAA,MACf,kBAAA,CAAmB,WAAA,iBAEvB,KAAA,EAAO,iBAAA,CAAkB,WAAA;EAdhB;EAiBX,OAAA;EAjBE;EAmBF,MAAA;EAEA,OAAA;AAAA;AAAA,UAGe,kBAAA,SAA2B,YAAY;EApBpD;EAsBF,UAAA;EArBuC;EAuBvC,SAAA;EApBA;EAsBA,MAAA;AAAA;AAAA,cAmBW,MAAA,yBAA+B,WAAA,CAAY,WAAA;EAAA;EAmJtD,WAAA,CAAY,OAAA,GAAS,aAAA,CAAc,WAAA;EAInC,UAAA,CAAW,OAAA,EAAS,aAAA,CAAc,WAAA;EAkClC,IAAA,WAAe,sBAAA,CAAuB,WAAA,GACpC,YAAA,EAAc,gBAAA,CAAiB,CAAA;EA7NxB;;;;;;;AAOF;AAGT;;EA6OE,UAAA,CAAW,KAAA,EAAO,QAAA,IAAY,aAAA;EA7OwB;EAAA,IAgTlD,OAAA;EA9SJ;EAAA,IAmTI,OAAA;EA/SJ;EAoTA,IAAA;EApTM;EAyTN,IAAA;EAIA,OAAA,IAAW,YAAA;EAcX,OAAA;EAIA,QAAA,IAAY,WAAA;EAcZ,QAAA;IAAW,UAAA;IAAY;EAAA,GAAQ,WAAA;EAqB/B,aAAA,CACE,UAAA,GAAa,KAAA;IAAU,SAAA;EAAA;EAoCzB,UAAA,CAAW,OAAA,EAAS,MAAA;EA6BpB,KAAA,CAAM,OAAA,GAAU,kBAAA;EAmChB,IAAA;EAOA,OAAA,CAAQ,OAAA;EAvPU;EAwUlB,aAAA,CAAc,IAAA,EAAM,YAAA,GAAe,YAAA;EAhOvB;EA4PZ,+BAAA;EA9OuB;EAyPvB,+BAAA;EAnOe;EAkPf,gBAAA,EAAkB,WAAA,CAAY,WAAA;AAAA"}
|
|
@@ -4,13 +4,13 @@ import { getFiletypeFromFileName } from "../utils/getFiletypeFromFileName.js";
|
|
|
4
4
|
import { isSafari } from "../utils/platform.js";
|
|
5
5
|
import { isMoveCursorShortcut, isPrimaryModifier } from "./platform.js";
|
|
6
6
|
import { resolveEditorCommandFromKeyboardEvent, resolveFindAgainShortcut } from "./command.js";
|
|
7
|
-
import { EditStack } from "./editStack.js";
|
|
8
7
|
import editor_default from "./editor2.js";
|
|
8
|
+
import { EditStack } from "./editStack.js";
|
|
9
9
|
import { resolveBlockCommentEdits, resolveCommentConfig, resolveLineCommentEdits } from "./languages.js";
|
|
10
10
|
import { addEventListener, clampDomOffset, extend, getLineNumberAttr, h, lookupScrollContainer, round } from "./utils.js";
|
|
11
11
|
import { applyDocumentChangeToLineAnnotations, renderLineAnnotations } from "./lineAnnotations.js";
|
|
12
12
|
import { PopoverManager } from "./popover.js";
|
|
13
|
-
import { applyDeleteCharacterToSelections, applyDeleteHardLineForwardToSelections, applyDeleteSoftLineBackwardToSelections, applyDeleteWordBackwardToSelections, applyTextChangeToSelections, applyTextReplaceToSelections, applyTransposeToSelections, comparePosition, convertSelection, createSelectionFrom, createSelectionFromAnchorAndFocusOffsets, expandCollapsedSelectionToWord, extendSelection, extendSelections, findNextMatch, getAutoSurroundReplacementTexts, getCaretPosition, getDocumentBoundarySelection, getDocumentFullSelection, getSelectedLineBlocks, getSelectionAnchor, getSelectionClipboardTexts, getSelectionText, isCollapsedSelection, isLineEditable, mapCursorMove, mapSelectionShift, mergeOverlappingSelections, remapSelectionsAfterEdits, resolveIndentEdits, resolveSelectionCut, selectionIntersects, shiftSelectionLines } from "./selection.js";
|
|
13
|
+
import { applyDeleteCharacterToSelections, applyDeleteHardLineForwardToSelections, applyDeleteSoftLineBackwardToSelections, applyDeleteWordBackwardToSelections, applyTextChangeToSelections, applyTextReplaceToSelections, applyTransposeToSelections, comparePosition, convertSelection, createSelectionFrom, createSelectionFromAnchorAndFocusOffsets, expandCollapsedSelectionToWord, extendSelection, extendSelections, findNextMatch, getAutoSurroundReplacementTexts, getCaretPosition, getDocumentBoundarySelection, getDocumentFullSelection, getSelectedLineBlocks, getSelectionAnchor, getSelectionClipboardTexts, getSelectionText, isCollapsedSelection, isLineEditable, mapCursorMove, mapSelectionShift, mergeOverlappingSelections, remapSelectionsAfterEdits, resolveIndentEdits, resolveSelectionCut, selectionIntersects, shiftSelectionLines, snapCharacterToGraphemeBoundary } from "./selection.js";
|
|
14
14
|
import { MarkerRenderer, markerSeverityDatasetKey } from "./marker.js";
|
|
15
15
|
import { findBracketMatchRanges } from "./matchBrackets.js";
|
|
16
16
|
import { createSpriteElement } from "./sprite.js";
|
|
@@ -100,6 +100,7 @@ var Editor = class {
|
|
|
100
100
|
#isComposing = false;
|
|
101
101
|
#isGutterMouseDown = false;
|
|
102
102
|
#isContentMouseDown = false;
|
|
103
|
+
#altColumnDrag;
|
|
103
104
|
#shiftKeyPressed = false;
|
|
104
105
|
#selectionStart;
|
|
105
106
|
#deletedSelectionText = "";
|
|
@@ -330,8 +331,6 @@ var Editor = class {
|
|
|
330
331
|
this.#globalEventDisposes = void 0;
|
|
331
332
|
this.#editorEventDisposes?.forEach((dispose) => dispose());
|
|
332
333
|
this.#editorEventDisposes = void 0;
|
|
333
|
-
this.#selectEventDisposes?.forEach((dispose) => dispose());
|
|
334
|
-
this.#selectEventDisposes = void 0;
|
|
335
334
|
this.#detach?.(recycle);
|
|
336
335
|
this.#detach = void 0;
|
|
337
336
|
this.#gutterWidthCache = void 0;
|
|
@@ -711,12 +710,11 @@ var Editor = class {
|
|
|
711
710
|
this.#setEditorActiveLineSafe(null);
|
|
712
711
|
this.#gutterWidthCache = void 0;
|
|
713
712
|
this.#contentWidthCache = void 0;
|
|
714
|
-
this.#
|
|
713
|
+
this.#resetSelectionGesture();
|
|
715
714
|
this.#suppressNativeSelectionSync = false;
|
|
716
715
|
this.#overlayElements?.forEach((el) => el.remove());
|
|
717
716
|
this.#overlayElements = void 0;
|
|
718
717
|
this.#selections = void 0;
|
|
719
|
-
this.#reservedSelections = void 0;
|
|
720
718
|
this.#scrollingToLine = void 0;
|
|
721
719
|
this.#markerRenderer?.cleanup();
|
|
722
720
|
this.#markerRenderer = void 0;
|
|
@@ -796,6 +794,13 @@ var Editor = class {
|
|
|
796
794
|
this.#contentHasFocus = false;
|
|
797
795
|
this.#shouldIgnoreSelectionChange = false;
|
|
798
796
|
};
|
|
797
|
+
const finishMouseSelection = (event) => {
|
|
798
|
+
if (event.pointerType !== "mouse") return;
|
|
799
|
+
const refocusEditor = this.#isGutterMouseDown;
|
|
800
|
+
this.#resetSelectionGesture();
|
|
801
|
+
if (refocusEditor) this.#focus();
|
|
802
|
+
if (this.#options.enabledSelectionAction === true && this.#selections !== void 0 && this.#selections.length > 0 && !isCollapsedSelection(this.#selections.at(-1))) this.#updateSelections(this.#selections);
|
|
803
|
+
};
|
|
799
804
|
this.#globalEventDisposes = [
|
|
800
805
|
addEventListener(document, "focusin", (event) => {
|
|
801
806
|
if (!replacementFocusTargetIsContent(event)) cancelReplacementFocus();
|
|
@@ -828,24 +833,15 @@ var Editor = class {
|
|
|
828
833
|
const previous = this.#selections[0];
|
|
829
834
|
if (comparePosition(previous.start, selection.start) === 0 && comparePosition(previous.end, selection.end) === 0) selection.direction = previous.direction;
|
|
830
835
|
}
|
|
836
|
+
if (this.#altColumnDrag !== void 0) {
|
|
837
|
+
this.#altColumnDrag.focusLine = getCaretPosition(selection).line;
|
|
838
|
+
if (this.#updateAltColumnSelections()) return;
|
|
839
|
+
}
|
|
831
840
|
if (this.#reservedSelections !== void 0) this.#updateSelections([...this.#reservedSelections.filter((reservedSelection) => !selectionIntersects(reservedSelection, selection)), selection]);
|
|
832
841
|
else this.#updateSelections([selection]);
|
|
833
842
|
}, { passive: true }),
|
|
834
|
-
addEventListener(document, "pointerup",
|
|
835
|
-
|
|
836
|
-
this.#selectEventDisposes?.forEach((dispose) => dispose());
|
|
837
|
-
this.#selectEventDisposes = void 0;
|
|
838
|
-
if (this.#isGutterMouseDown) {
|
|
839
|
-
this.#isGutterMouseDown = false;
|
|
840
|
-
this.#focus();
|
|
841
|
-
}
|
|
842
|
-
this.#shouldIgnoreSelectionChange = false;
|
|
843
|
-
this.#isContentMouseDown = false;
|
|
844
|
-
this.#shiftKeyPressed = false;
|
|
845
|
-
this.#selectionStart = void 0;
|
|
846
|
-
this.#reservedSelections = void 0;
|
|
847
|
-
if (this.#options.enabledSelectionAction === true && this.#selections !== void 0 && this.#selections.length > 0 && !isCollapsedSelection(this.#selections.at(-1))) this.#updateSelections(this.#selections);
|
|
848
|
-
}, { passive: true }),
|
|
843
|
+
addEventListener(document, "pointerup", finishMouseSelection, { passive: true }),
|
|
844
|
+
addEventListener(document, "pointercancel", finishMouseSelection, { passive: true }),
|
|
849
845
|
addEventListener(document, "keydown", (e) => {
|
|
850
846
|
if (e.key === "Shift") this.#selectionStart = this.#selections?.at(-1);
|
|
851
847
|
}, { passive: true }),
|
|
@@ -854,6 +850,17 @@ var Editor = class {
|
|
|
854
850
|
}, { passive: true })
|
|
855
851
|
];
|
|
856
852
|
}
|
|
853
|
+
#resetSelectionGesture() {
|
|
854
|
+
this.#selectEventDisposes?.forEach((dispose) => dispose());
|
|
855
|
+
this.#selectEventDisposes = void 0;
|
|
856
|
+
this.#shouldIgnoreSelectionChange = false;
|
|
857
|
+
this.#isGutterMouseDown = false;
|
|
858
|
+
this.#isContentMouseDown = false;
|
|
859
|
+
this.#altColumnDrag = void 0;
|
|
860
|
+
this.#shiftKeyPressed = false;
|
|
861
|
+
this.#selectionStart = void 0;
|
|
862
|
+
this.#reservedSelections = void 0;
|
|
863
|
+
}
|
|
857
864
|
#replaceSelectEventListeners(disposes) {
|
|
858
865
|
this.#selectEventDisposes?.forEach((dispose) => dispose());
|
|
859
866
|
this.#selectEventDisposes = disposes;
|
|
@@ -889,6 +896,7 @@ var Editor = class {
|
|
|
889
896
|
this.#canMountSelectionAction = true;
|
|
890
897
|
this.#suppressNativeSelectionSync = false;
|
|
891
898
|
if (e.pointerType !== "mouse") return;
|
|
899
|
+
this.#altColumnDrag = void 0;
|
|
892
900
|
if (this.#isDeletedLineTarget(e)) {
|
|
893
901
|
this.#setDeletedTextSelectionActive(true);
|
|
894
902
|
if (this.#selections !== void 0) this.#updateSelections([]);
|
|
@@ -896,17 +904,39 @@ var Editor = class {
|
|
|
896
904
|
}
|
|
897
905
|
this.#setDeletedTextSelectionActive(false);
|
|
898
906
|
this.#markerRenderer?.removePopover();
|
|
907
|
+
const selectEventDisposes = [];
|
|
899
908
|
if (isSafari() && this.#lineAnnotations !== void 0 && this.#lineAnnotations.length > 0) {
|
|
900
909
|
const annotationDisposes = [...contentEl.querySelectorAll("[data-line-annotation]")].map((el) => [addEventListener(el, "mouseenter", () => {
|
|
901
910
|
this.#shouldIgnoreSelectionChange = true;
|
|
902
911
|
}), addEventListener(el, "mouseleave", () => {
|
|
903
912
|
this.#shouldIgnoreSelectionChange = false;
|
|
904
913
|
})]).flat();
|
|
905
|
-
|
|
914
|
+
selectEventDisposes.push(...annotationDisposes);
|
|
906
915
|
}
|
|
907
916
|
this.#isContentMouseDown = true;
|
|
917
|
+
const isAltColumnDrag = e.button === 0 && e.altKey && !e.ctrlKey && !e.metaKey && !e.shiftKey;
|
|
908
918
|
this.#selectionStart = void 0;
|
|
909
|
-
if (
|
|
919
|
+
if (isAltColumnDrag) {
|
|
920
|
+
this.#altColumnDrag = {
|
|
921
|
+
pointerId: e.pointerId,
|
|
922
|
+
startClientX: e.clientX,
|
|
923
|
+
clientX: e.clientX,
|
|
924
|
+
startScrollLeft: contentEl.parentElement?.scrollLeft ?? 0
|
|
925
|
+
};
|
|
926
|
+
this.#reservedSelections = void 0;
|
|
927
|
+
this.#selections = void 0;
|
|
928
|
+
this.#updateSelections([]);
|
|
929
|
+
selectEventDisposes.push(addEventListener(document, "pointermove", (moveEvent) => {
|
|
930
|
+
const drag = this.#altColumnDrag;
|
|
931
|
+
if (drag === void 0 || moveEvent.pointerType !== "mouse" || moveEvent.pointerId !== drag.pointerId) return;
|
|
932
|
+
drag.clientX = moveEvent.clientX;
|
|
933
|
+
this.#updateAltColumnSelections();
|
|
934
|
+
}, {
|
|
935
|
+
capture: true,
|
|
936
|
+
passive: true
|
|
937
|
+
}));
|
|
938
|
+
} else if (e.button === 0 && isPrimaryModifier(e)) this.#reservedSelections = this.#selections?.map((selection) => ({ ...selection }));
|
|
939
|
+
this.#replaceSelectEventListeners(selectEventDisposes);
|
|
910
940
|
if (e.shiftKey) {
|
|
911
941
|
const primarySelection = this.#selections?.at(-1);
|
|
912
942
|
if (primarySelection !== void 0) {
|
|
@@ -924,6 +954,7 @@ var Editor = class {
|
|
|
924
954
|
if (!targetIsContentElement(e)) return;
|
|
925
955
|
this.#canMountSelectionAction = true;
|
|
926
956
|
this.#suppressNativeSelectionSync = false;
|
|
957
|
+
if (e.isComposing || e.keyCode === 229) return;
|
|
927
958
|
const command = resolveEditorCommandFromKeyboardEvent(e, this.#options.keymap);
|
|
928
959
|
if (command !== void 0) {
|
|
929
960
|
e.preventDefault();
|
|
@@ -1610,7 +1641,7 @@ var Editor = class {
|
|
|
1610
1641
|
if (tokenizer === void 0 || fileInstance === void 0 || textDocument === void 0 || contentEl === void 0) return;
|
|
1611
1642
|
tokenizer.stopBackgroundTokenize();
|
|
1612
1643
|
const t = performance.now();
|
|
1613
|
-
const dirtyLines = tokenizer.tokenize(change, renderRange, !this.#isDiff);
|
|
1644
|
+
const dirtyLines = tokenizer.tokenize(change, renderRange, !this.#isDiff && fileInstance.getLinePosition !== void 0);
|
|
1614
1645
|
const t2 = performance.now();
|
|
1615
1646
|
if (dirtyLines.size > 0) {
|
|
1616
1647
|
const children = contentEl.children;
|
|
@@ -2068,6 +2099,48 @@ var Editor = class {
|
|
|
2068
2099
|
if (this.#selections !== void 0 || this.#matches !== void 0 || this.#markerRenderer !== void 0) this.#updateSelections(this.#selections ?? []);
|
|
2069
2100
|
});
|
|
2070
2101
|
}
|
|
2102
|
+
#updateAltColumnSelections() {
|
|
2103
|
+
const drag = this.#altColumnDrag;
|
|
2104
|
+
const selectionStart = this.#selectionStart;
|
|
2105
|
+
const textDocument = this.#textDocument;
|
|
2106
|
+
if (drag === void 0 || drag.focusLine === void 0 || selectionStart === void 0 || textDocument === void 0) return false;
|
|
2107
|
+
const anchor = selectionStart.direction === -1 ? selectionStart.end : selectionStart.start;
|
|
2108
|
+
const scrollLeft = this.#contentElement?.parentElement?.scrollLeft ?? 0;
|
|
2109
|
+
const characterDeltaRaw = (drag.clientX - drag.startClientX + scrollLeft - drag.startScrollLeft) / this.#metrics.ch;
|
|
2110
|
+
const characterDelta = characterDeltaRaw < 0 ? -Math.round(-characterDeltaRaw) : Math.round(characterDeltaRaw);
|
|
2111
|
+
const focusCharacter = Math.max(0, anchor.character + characterDelta);
|
|
2112
|
+
const goal = {
|
|
2113
|
+
line: drag.focusLine,
|
|
2114
|
+
character: focusCharacter
|
|
2115
|
+
};
|
|
2116
|
+
if (drag.renderedGoal !== void 0 && comparePosition(drag.renderedGoal, goal) === 0) return true;
|
|
2117
|
+
drag.renderedGoal = goal;
|
|
2118
|
+
const selections = [];
|
|
2119
|
+
const step = goal.line < anchor.line ? -1 : 1;
|
|
2120
|
+
for (let line = anchor.line;; line += step) {
|
|
2121
|
+
if (this.#isLineRenderable(line)) {
|
|
2122
|
+
const lineText = textDocument.getLineText(line);
|
|
2123
|
+
const anchorOffset = Math.min(anchor.character, lineText.length);
|
|
2124
|
+
const focusOffset = Math.min(focusCharacter, lineText.length);
|
|
2125
|
+
const anchorCharacter = snapCharacterToGraphemeBoundary(lineText, anchorOffset);
|
|
2126
|
+
const lineFocusCharacter = focusOffset === anchorOffset ? anchorCharacter : snapCharacterToGraphemeBoundary(lineText, focusOffset);
|
|
2127
|
+
selections.push({
|
|
2128
|
+
start: {
|
|
2129
|
+
line,
|
|
2130
|
+
character: Math.min(anchorCharacter, lineFocusCharacter)
|
|
2131
|
+
},
|
|
2132
|
+
end: {
|
|
2133
|
+
line,
|
|
2134
|
+
character: Math.max(anchorCharacter, lineFocusCharacter)
|
|
2135
|
+
},
|
|
2136
|
+
direction: anchorCharacter === lineFocusCharacter ? 0 : anchorCharacter < lineFocusCharacter ? 1 : -1
|
|
2137
|
+
});
|
|
2138
|
+
}
|
|
2139
|
+
if (line === goal.line) break;
|
|
2140
|
+
}
|
|
2141
|
+
this.#updateSelections(selections);
|
|
2142
|
+
return true;
|
|
2143
|
+
}
|
|
2071
2144
|
#updateSelections(selections) {
|
|
2072
2145
|
this.__postponeBgTokenizeToNextFrame();
|
|
2073
2146
|
this.#primaryCaretElement = void 0;
|