|
8 | 8 | import 'vs/css!./media/searchviewlet'; |
9 | 9 | import nls = require('vs/nls'); |
10 | 10 | import {TPromise, PPromise} from 'vs/base/common/winjs.base'; |
11 | | -import {EditorType, IEditor, IDiffEditorOptions} from 'vs/editor/common/editorCommon'; |
| 11 | +import {EditorType, IDiffEditorOptions} from 'vs/editor/common/editorCommon'; |
| 12 | +import {IDiffEditor} from 'vs/editor/browser/editorBrowser'; |
12 | 13 | import lifecycle = require('vs/base/common/lifecycle'); |
13 | 14 | import errors = require('vs/base/common/errors'); |
14 | 15 | import aria = require('vs/base/browser/ui/aria/aria'); |
@@ -939,10 +940,15 @@ export class SearchViewlet extends Viewlet { |
939 | 940 | private openReplacePreviewEditor(element: FileMatchOrMatch, preserveFocus?: boolean, sideBySide?: boolean, pinned?: boolean): TPromise<any> { |
940 | 941 | return this.replaceService.getInput(element instanceof Match ? element.parent() : element, this.viewModel.replaceText).then((editorInput) => { |
941 | 942 | this.editorService.openEditor(editorInput, {preserveFocus: preserveFocus, pinned: pinned}).then((editor) => { |
942 | | - let editorControl= (<IEditor>editor.getControl()); |
| 943 | + let editorControl= (<IDiffEditor>editor.getControl()); |
943 | 944 | editorControl.updateOptions(<IDiffEditorOptions>{originalEditable: true}); |
944 | 945 | if (element instanceof Match) { |
945 | | - editorControl.revealLineInCenter(element.range().startLineNumber); |
| 946 | + let range= element.range(); |
| 947 | + editorControl.revealLineInCenter(range.startLineNumber); |
| 948 | + editorControl.getOriginalEditor().setPosition({lineNumber: range.startLineNumber, column: range.startColumn}); |
| 949 | + } |
| 950 | + if (!preserveFocus) { |
| 951 | + editorControl.getOriginalEditor().focus(); |
946 | 952 | } |
947 | 953 | }); |
948 | 954 | }); |
|
0 commit comments