We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 91d3506 commit 90dd67aCopy full SHA for 90dd67a
src/diff/cell.ts
@@ -120,9 +120,15 @@ class CodeMirrorSplitDiffWidget extends BaseDiffWidget {
120
arrowBtn.title = 'Revert Block';
121
122
arrowBtn.onclick = () => {
123
+ const docB = paneB.state.doc;
124
+ const docLength = docB.length;
125
+
126
+ const safeFromB = Math.min(Math.max(0, fromB), docLength);
127
+ const safeToB = Math.min(Math.max(safeFromB, toB), docLength);
128
129
const origText = paneA.state.doc.sliceString(fromA, toA);
130
paneB.dispatch({
- changes: { from: fromB, to: toB, insert: origText }
131
+ changes: { from: safeFromB, to: safeToB, insert: origText }
132
});
133
this._renderArrowButtons();
134
};
0 commit comments