@@ -39,6 +39,7 @@ import { AbstractTextEditor } from 'vs/workbench/browser/parts/editor/textEditor
39
39
import { DEFAULT_EDITOR_ASSOCIATION , EditorInputWithOptions , IEditorOpenContext , IResourceMergeEditorInput } from 'vs/workbench/common/editor' ;
40
40
import { EditorInput } from 'vs/workbench/common/editor/editorInput' ;
41
41
import { applyTextEditorOptions } from 'vs/workbench/common/editor/editorOptions' ;
42
+ import { readTransientState , writeTransientState } from 'vs/workbench/contrib/codeEditor/browser/toggleWordWrap' ;
42
43
import { MergeEditorInput } from 'vs/workbench/contrib/mergeEditor/browser/mergeEditorInput' ;
43
44
import { DocumentMapping , getOppositeDirection , MappingDirection } from 'vs/workbench/contrib/mergeEditor/browser/model/mapping' ;
44
45
import { MergeEditorModel } from 'vs/workbench/contrib/mergeEditor/browser/model/mergeEditorModel' ;
@@ -117,6 +118,7 @@ export class MergeEditor extends AbstractTextEditor<IMergeEditorViewState> {
117
118
@IEditorService editorService : IEditorService ,
118
119
@IEditorGroupsService editorGroupService : IEditorGroupsService ,
119
120
@IFileService fileService : IFileService ,
121
+ @ICodeEditorService private readonly _codeEditorService : ICodeEditorService ,
120
122
) {
121
123
super ( MergeEditor . ID , telemetryService , instantiation , storageService , textResourceConfigurationService , themeService , editorService , editorGroupService , fileService ) ;
122
124
@@ -177,7 +179,6 @@ export class MergeEditor extends AbstractTextEditor<IMergeEditorViewState> {
177
179
)
178
180
) ;
179
181
180
-
181
182
// TODO@jrieken make this proper: add menu id and allow extensions to contribute
182
183
const toolbarMenu = this . _menuService . createMenu ( MenuId . MergeToolbar , this . _contextKeyService ) ;
183
184
const toolbarMenuDisposables = new DisposableStore ( ) ;
@@ -377,6 +378,19 @@ export class MergeEditor extends AbstractTextEditor<IMergeEditorViewState> {
377
378
} ) ;
378
379
} , 'update alignment view zones' ) ) ;
379
380
381
+ // word wrap special case - sync transient state from result model to input[1|2] models
382
+ const mirrorWordWrapTransientState = ( ) => {
383
+ const state = readTransientState ( model . resultTextModel , this . _codeEditorService ) ;
384
+ writeTransientState ( model . input2 . textModel , state , this . _codeEditorService ) ;
385
+ writeTransientState ( model . input1 . textModel , state , this . _codeEditorService ) ;
386
+ } ;
387
+ this . _sessionDisposables . add ( this . _codeEditorService . onDidChangeTransientModelProperty ( candidate => {
388
+ if ( candidate === this . inputResultView . editor . getModel ( ) ) {
389
+ mirrorWordWrapTransientState ( ) ;
390
+ }
391
+ } ) ) ;
392
+ mirrorWordWrapTransientState ( ) ;
393
+
380
394
381
395
// detect when base, input1, and input2 become empty and replace THIS editor with its result editor
382
396
// TODO@jrieken @hediet this needs a better/cleaner solution
0 commit comments