@@ -59,7 +59,7 @@ class CodeMirrorSplitDiffWidget extends BaseDiffWidget {
5959 python ( ) ,
6060 EditorView . editable . of ( false ) ,
6161 jupyterTheme ,
62- splitDiffDecorationField
62+ splitDiffDecoField
6363 ]
6464 } ,
6565 b : {
@@ -69,15 +69,15 @@ class CodeMirrorSplitDiffWidget extends BaseDiffWidget {
6969 python ( ) ,
7070 EditorView . editable . of ( true ) ,
7171 jupyterTheme ,
72- splitDiffDecorationField ,
72+ splitDiffDecoField ,
7373 EditorView . updateListener . of ( update => {
7474 if ( update . docChanged ) {
7575 const newText = update . state . doc . toString ( ) ;
7676
7777 this . _modifiedCode = newText ;
7878 this . _newSource = newText ;
7979
80- this . _renderMergeButtons ( ) ;
80+ this . _renderArrowButtons ( ) ;
8181 }
8282 } )
8383 ]
@@ -87,17 +87,17 @@ class CodeMirrorSplitDiffWidget extends BaseDiffWidget {
8787 highlightChanges : true
8888 } ) ;
8989
90- this . _renderMergeButtons ( ) ;
90+ this . _renderArrowButtons ( ) ;
9191 }
9292
9393 /**
9494 * Render "merge change" buttons in the diff on left editor.
9595 */
96- private _renderMergeButtons ( ) : void {
97- const editorA = this . _splitView . a ;
98- const editorB = this . _splitView . b ;
96+ private _renderArrowButtons ( ) : void {
97+ const paneA = this . _splitView . a ;
98+ const paneB = this . _splitView . b ;
9999
100- const result = getChunks ( editorB . state ) ;
100+ const result = getChunks ( paneB . state ) ;
101101 const chunks = result ?. chunks ?? [ ] ;
102102
103103 const updatedSet = new Set < string > ( ) ;
@@ -127,20 +127,20 @@ class CodeMirrorSplitDiffWidget extends BaseDiffWidget {
127127 const arrowWidget = Decoration . widget ( {
128128 widget : new ( class extends WidgetType {
129129 toDOM ( ) {
130- const btn = document . createElement ( 'button' ) ;
131- btn . textContent = '🡪' ;
132- btn . className = 'jp-DiffMergeArrow' ;
133- btn . onclick = ( ) => {
134- const origText = editorA . state . doc . sliceString ( fromA , toA ) ;
130+ const arrowBtn = document . createElement ( 'button' ) ;
131+ arrowBtn . textContent = '🡪' ;
132+ arrowBtn . className = 'jp-DiffMergeArrow' ;
133+ arrowBtn . onclick = ( ) => {
134+ const origText = paneA . state . doc . sliceString ( fromA , toA ) ;
135135
136- editorB . dispatch ( {
136+ paneB . dispatch ( {
137137 changes : { from : fromB , to : toB , insert : origText }
138138 } ) ;
139139
140140 diffWidget . _activeChunks . delete ( id ) ;
141- diffWidget . _renderMergeButtons ( ) ;
141+ diffWidget . _renderArrowButtons ( ) ;
142142 } ;
143- return btn ;
143+ return arrowBtn ;
144144 }
145145 } ) ( ) ,
146146 side : 1
@@ -149,8 +149,8 @@ class CodeMirrorSplitDiffWidget extends BaseDiffWidget {
149149 builder . add ( fromA , fromA , arrowWidget ) ;
150150 } ) ;
151151
152- editorA . dispatch ( {
153- effects : addSplitDiffDecorations . of ( builder . finish ( ) )
152+ paneA . dispatch ( {
153+ effects : addSplitDiffDeco . of ( builder . finish ( ) )
154154 } ) ;
155155 }
156156
@@ -171,15 +171,15 @@ class CodeMirrorSplitDiffWidget extends BaseDiffWidget {
171171 } ;
172172}
173173
174- const addSplitDiffDecorations = StateEffect . define < DecorationSet > ( ) ;
174+ const addSplitDiffDeco = StateEffect . define < DecorationSet > ( ) ;
175175
176- const splitDiffDecorationField = StateField . define < DecorationSet > ( {
176+ const splitDiffDecoField = StateField . define < DecorationSet > ( {
177177 create ( ) {
178178 return Decoration . none ;
179179 } ,
180180 update ( deco , tr ) {
181181 for ( const ef of tr . effects ) {
182- if ( ef . is ( addSplitDiffDecorations ) ) {
182+ if ( ef . is ( addSplitDiffDeco ) ) {
183183 return ef . value ;
184184 }
185185 }
0 commit comments