Skip to content

Commit 21e69c9

Browse files
committed
Merge branch 'right-pane' into arrow
2 parents 1c9b755 + e05ffb0 commit 21e69c9

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/diff/cell.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,15 @@ class CodeMirrorSplitDiffWidget extends BaseDiffWidget {
6969
python(),
7070
EditorView.editable.of(true),
7171
jupyterTheme,
72-
splitDiffDecorationField
72+
splitDiffDecorationField,
73+
EditorView.updateListener.of(update => {
74+
if (update.docChanged) {
75+
const newText = update.state.doc.toString();
76+
77+
this._modifiedCode = newText;
78+
this._newSource = newText;
79+
}
80+
})
7381
]
7482
},
7583
parent: this.node,

src/widget.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ export abstract class BaseDiffWidget extends Widget {
100100
*/
101101
public onAcceptClick(): void {
102102
if (this._cell) {
103-
this._cell.sharedModel.setSource(this._newSource);
103+
this._cell.sharedModel.setSource(this._newSource || this._originalSource);
104104
this._closeDiffView();
105105
}
106106
}
@@ -191,9 +191,9 @@ export abstract class BaseDiffWidget extends Widget {
191191
private _cell: ICellModel;
192192
private _cellFooterTracker: ICellFooterTracker;
193193
private _originalSource: string;
194-
private _newSource: string;
195194
private _showActionButtons: boolean;
196195
private _openDiff: boolean;
197196
private _toggleButton: ToolbarButton | null = null;
198197
private _trans: TranslationBundle;
198+
public _newSource: string;
199199
}

0 commit comments

Comments
 (0)