The best way to control Claude Code, Codex and more from any computer or phone
fix(web): a drag selection released during a window shift keeps its unmounted anchor (#39681)
Julius Marminge committed
Nov 20, 2026 at 03:43 UTC
37e14f5c814187203e0d1a9c9baa8168ce08e67a
2 files changed
+29
-17
patches/@pierre__diffs@1.7.0-beta.4.patch
+24
-12
@@ -1,5 +1,5 @@
1
diff --git a/dist/editor/editor.js b/dist/editor/editor.js
2
-index b4c280390b52434f63fbe7916d81b150d9006fb4..8f6df87aa893fe413811b95f7b7d2ab7ea515750 100644
2
+index b4c280390b52434f63fbe7916d81b150d9006fb4..db87ba385f927d793a80d908cd575216d22a09a7 100644
3
--- a/dist/editor/editor.js
4
+++ b/dist/editor/editor.js
5
@@ -95,6 +95,8 @@ var Editor = class {
@@ -74,7 +74,19 @@ index b4c280390b52434f63fbe7916d81b150d9006fb4..8f6df87aa893fe413811b95f7b7d2ab7
74
const replacementFocusTargetIsContent = (event) => {
75
const target = event.composedPath()[0];
76
return target instanceof Node && this.#contentElement?.contains(target) === true;
77
-@@ -1061,15 +1082,17 @@ var Editor = class {
77
+@@ -1034,7 +1055,11 @@ var Editor = class {
78
+ const finishMouseSelection = (event) => {
79
+ if (event.pointerType !== "mouse") return;
80
+ const refocusEditor = this.#isGutterMouseDown;
81
++ const primarySelection = this.#isContentMouseDown ? this.#selections?.at(-1) : void 0;
82
++ const renderRange = this.#renderRange;
83
++ const selectionLeavesRenderRange = primarySelection !== void 0 && renderRange !== void 0 && (primarySelection.start.line < renderRange.startingLine || primarySelection.end.line >= renderRange.startingLine + renderRange.totalLines);
84
+ this.#resetSelectionGesture();
85
++ if (selectionLeavesRenderRange) this.#suppressNativeSelectionSync = true;
86
+ if (refocusEditor) this.#focus();
87
+ if (this.#options.enabledSelectionAction === true && this.#selections !== void 0 && this.#selections.length > 0 && !isCollapsedSelection(this.#selections.at(-1))) this.#updateSelections(this.#selections);
88
+ };
89
+@@ -1061,15 +1086,17 @@ var Editor = class {
90
if (this.#selections !== void 0 && this.#selections.length > 1 && !this.#isContentMouseDown) return;
91
const composedRange = getComposedSelectionRange(shadowRoot);
92
if (composedRange === void 0 || !this.#rangeBelongsToEditor(composedRange)) return;
@@ -95,7 +107,7 @@ index b4c280390b52434f63fbe7916d81b150d9006fb4..8f6df87aa893fe413811b95f7b7d2ab7
107
else if (this.#selections !== void 0 && this.#selections.length === 1) {
108
const previous = this.#selections[0];
109
if (comparePosition(previous.start, selection.start) === 0 && comparePosition(previous.end, selection.end) === 0) selection.direction = previous.direction;
98
-@@ -1104,8 +1127,50 @@ var Editor = class {
110
+@@ -1104,8 +1131,50 @@ var Editor = class {
111
this.#altColumnDrag = void 0;
112
this.#shiftKeyPressed = false;
113
this.#selectionStart = void 0;
@@ -146,7 +158,7 @@ index b4c280390b52434f63fbe7916d81b150d9006fb4..8f6df87aa893fe413811b95f7b7d2ab7
158
#replaceSelectEventListeners(disposes) {
159
this.#selectEventDisposes?.forEach((dispose) => dispose());
160
this.#selectEventDisposes = disposes;
149
-@@ -1130,6 +1195,7 @@ var Editor = class {
161
+@@ -1130,6 +1199,7 @@ var Editor = class {
162
this.#editorEventDisposes = [
163
addEventListener(contentEl, "focus", () => {
164
this.#contentHasFocus = true;
@@ -154,7 +166,7 @@ index b4c280390b52434f63fbe7916d81b150d9006fb4..8f6df87aa893fe413811b95f7b7d2ab7
166
onFocus?.();
167
if (!this.#isContentMouseDown && !this.#isComposing && this.#focusRequest == null && this.#selections !== void 0 && this.#selections.length > 0) this.#setWindowSelection(this.#selections.at(-1));
168
}, { passive: true }),
157
-@@ -1163,6 +1229,7 @@ var Editor = class {
169
+@@ -1163,6 +1233,7 @@ var Editor = class {
170
this.#isContentMouseDown = true;
171
const isAltColumnDrag = e.button === 0 && e.altKey && !e.ctrlKey && !e.metaKey && !e.shiftKey;
172
this.#selectionStart = void 0;
@@ -162,7 +174,7 @@ index b4c280390b52434f63fbe7916d81b150d9006fb4..8f6df87aa893fe413811b95f7b7d2ab7
174
if (isAltColumnDrag) {
175
this.#altColumnDrag = {
176
pointerId: e.pointerId,
165
-@@ -1397,6 +1464,7 @@ var Editor = class {
177
+@@ -1397,6 +1468,7 @@ var Editor = class {
178
this.#resizeObserver = new ResizeObserver(this.#handleLayoutResize);
179
this.#resizeObserver.observe(contentEl);
180
this.#resizeObserver.observe(contentEl.parentElement);
@@ -170,7 +182,7 @@ index b4c280390b52434f63fbe7916d81b150d9006fb4..8f6df87aa893fe413811b95f7b7d2ab7
182
this.#computeContentOffset(contentEl);
183
}
184
#handleCustomPasteEvent = async () => {
173
-@@ -1852,7 +1920,9 @@ var Editor = class {
185
+@@ -1852,7 +1924,9 @@ var Editor = class {
186
const change = textDocument.applyEdits(edits, true, selections, nextSelections, true);
187
if (change !== void 0) this.#applyChange(change, nextSelections);
188
}
@@ -181,7 +193,7 @@ index b4c280390b52434f63fbe7916d81b150d9006fb4..8f6df87aa893fe413811b95f7b7d2ab7
193
const lineAnnotations = this.#lineAnnotations?.length ?? 0;
194
const prevGutterWidth = this.#gutterWidthCache;
195
const prevContentWidth = this.#contentWidthCache;
184
-@@ -1860,12 +1930,12 @@ var Editor = class {
196
+@@ -1860,12 +1934,12 @@ var Editor = class {
197
this.#contentWidthCache = void 0;
198
const gutterWidthChanged = this.#getGutterWidth() !== prevGutterWidth;
199
const contentWidthChanged = this.#getContentWidth() !== prevContentWidth;
@@ -197,7 +209,7 @@ index b4c280390b52434f63fbe7916d81b150d9006fb4..8f6df87aa893fe413811b95f7b7d2ab7
209
}
210
if (this.#selections !== void 0 || this.#matches !== void 0 || this.#markerRenderer !== void 0) {
211
this.#updateSelections(this.#selections ?? []);
200
-@@ -2013,7 +2083,13 @@ var Editor = class {
212
+@@ -2013,7 +2087,13 @@ var Editor = class {
213
return;
214
}
215
const primaryPosition = primarySelection.direction === -1 ? primarySelection.end : primarySelection.start;
@@ -212,7 +224,7 @@ index b4c280390b52434f63fbe7916d81b150d9006fb4..8f6df87aa893fe413811b95f7b7d2ab7
224
this.#focus(primaryPosition, true, restore);
225
}
226
#replacementFocusIsAvailable(contentElement) {
215
-@@ -2123,6 +2199,16 @@ var Editor = class {
227
+@@ -2123,6 +2203,16 @@ var Editor = class {
228
this.#scrollCaretIntoView(line, character, "nearest");
229
}
230
};
@@ -229,7 +241,7 @@ index b4c280390b52434f63fbe7916d81b150d9006fb4..8f6df87aa893fe413811b95f7b7d2ab7
241
#focusAt(position) {
242
if (this.#focusRequest?.restore != null) this.#restoreReplacementFocus(position);
243
else this.#focus(position);
232
-@@ -2145,6 +2231,19 @@ var Editor = class {
244
+@@ -2145,6 +2235,19 @@ var Editor = class {
245
this.#scrollingToLineNoFocus = false;
246
return;
247
}
@@ -249,7 +261,7 @@ index b4c280390b52434f63fbe7916d81b150d9006fb4..8f6df87aa893fe413811b95f7b7d2ab7
261
let yFix = 0;
262
if (this.#scrollingToLine === line && this.#contentElement !== void 0) for (let i = this.#contentElement.childElementCount - 1; i >= 0; i--) {
263
const child = this.#contentElement.children[i];
252
-@@ -3370,6 +3469,7 @@ var Editor = class {
264
+@@ -3370,6 +3473,7 @@ var Editor = class {
265
this.#searchPanel = searchPanel;
266
this.#retainSearchPanelFocus = false;
267
searchPanel.mount();
pnpm-lock.yaml
+5
-5
@@ -371,7 +371,7 @@ patchedDependencies:
371
'@expo/ui@58.0.27': 9f2547678939f4ec78fe45163b6455aad63d3c80353d7e0cc783f6a61a7ccc2f
372
'@ff-labs/fff-node@0.11.0': 93f62a76399b435a76588b2bef237db0a1e85880c1ac0d0759c416e9cc579252
373
'@muse-code/sdk@1.4.6': 7b495b607fc5d76b444c7c4d58821e839726a30e6f3c53564f0d59f2d5b42101
374
- '@pierre/diffs@1.7.0-beta.4': a0c908c189c18b157a75adde780300616409204a24e97fd877254a2416e069af
374
+ '@pierre/diffs@1.7.0-beta.4': 7edcdd484a99c7ec0b2667499c4cb21d113ec9bea1f8570c0b0a030d33bbf1cd
375
'@react-native-ai/apple@0.12.0': 2d09870c2848d185cb05b53ed823a46e12dba519324d8dd8e584e28731990f9d
376
'@react-native-menu/menu@2.0.0': 6872ba71b9847c5a0210b1b896923dadc3860faedfe28d9f062bcedfe786ef1d
377
'@react-navigation/native-stack@7.21.0': 990d575444c4af2ce8218b3b7a8280fe244c03abbdb32b822a2e862f791dbf42
@@ -581,7 +581,7 @@ importers:
581
version: 0.3.0
582
'@pierre/diffs':
583
specifier: 1.7.0-beta.4
584
- version: 1.7.0-beta.4(patch_hash=a0c908c189c18b157a75adde780300616409204a24e97fd877254a2416e069af)(@shikijs/themes@4.2.0)(react-dom@19.3.0(react@19.3.0))(react@19.3.0)
584
+ version: 1.7.0-beta.4(patch_hash=7edcdd484a99c7ec0b2667499c4cb21d113ec9bea1f8570c0b0a030d33bbf1cd)(@shikijs/themes@4.2.0)(react-dom@19.3.0(react@19.3.0))(react@19.3.0)
585
'@pierre/highlights':
586
specifier: 'catalog:'
587
version: 0.5.0
@@ -1105,7 +1105,7 @@ importers:
1105
version: 1.8.0
1106
'@pierre/diffs':
1107
specifier: 1.7.0-beta.4
1108
- version: 1.7.0-beta.4(patch_hash=a0c908c189c18b157a75adde780300616409204a24e97fd877254a2416e069af)(@shikijs/themes@4.2.0)(react-dom@19.3.0(react@19.3.0))(react@19.3.0)
1108
+ version: 1.7.0-beta.4(patch_hash=7edcdd484a99c7ec0b2667499c4cb21d113ec9bea1f8570c0b0a030d33bbf1cd)(@shikijs/themes@4.2.0)(react-dom@19.3.0(react@19.3.0))(react@19.3.0)
1109
'@pierre/trees':
1110
specifier: 1.0.0-beta.6
1111
version: 1.0.0-beta.6(@pierre/theme@2.0.0)(@shikijs/themes@4.2.0)(react-dom@19.3.0(react@19.3.0))(react@19.3.0)(shiki@4.2.0)
@@ -1521,7 +1521,7 @@ importers:
1521
dependencies:
1522
'@pierre/diffs':
1523
specifier: 1.7.0-beta.4
1524
- version: 1.7.0-beta.4(patch_hash=a0c908c189c18b157a75adde780300616409204a24e97fd877254a2416e069af)(@shikijs/themes@4.2.0)(react-dom@19.3.0(react@19.3.0))(react@19.3.0)
1524
+ version: 1.7.0-beta.4(patch_hash=7edcdd484a99c7ec0b2667499c4cb21d113ec9bea1f8570c0b0a030d33bbf1cd)(@shikijs/themes@4.2.0)(react-dom@19.3.0(react@19.3.0))(react@19.3.0)
1525
'@t3tools/contracts':
1526
specifier: workspace:*
1527
version: link:../contracts
@@ -16497,7 +16497,7 @@ snapshots:
16497
tslib: 2.8.1
16498
webcrypto-core: 1.9.2
16499
16500
- '@pierre/diffs@1.7.0-beta.4(patch_hash=a0c908c189c18b157a75adde780300616409204a24e97fd877254a2416e069af)(@shikijs/themes@4.2.0)(react-dom@19.3.0(react@19.3.0))(react@19.3.0)':
16500
+ '@pierre/diffs@1.7.0-beta.4(patch_hash=7edcdd484a99c7ec0b2667499c4cb21d113ec9bea1f8570c0b0a030d33bbf1cd)(@shikijs/themes@4.2.0)(react-dom@19.3.0(react@19.3.0))(react@19.3.0)':
16501
dependencies:
16502
'@pierre/highlights': 0.5.1
16503
'@pierre/patches': 0.0.1