diff --git a/src/vs/editor/contrib/find/common/findController.ts b/src/vs/editor/contrib/find/common/findController.ts index 4536b2b5b6fbb39a6c935fd94f6a1ab1673a2b90..a5dae70a8dcdf2e729d732e8c62c6002116503ca 100644 --- a/src/vs/editor/contrib/find/common/findController.ts +++ b/src/vs/editor/contrib/find/common/findController.ts @@ -508,13 +508,13 @@ export class StartFindReplaceAction extends EditorAction { let controller = CommonFindController.get(editor); let currentSelection = editor.getSelection(); // we only seed search string from selection when the current selection is single line and not empty. - let seedSearchStringFromSelection = currentSelection.isEmpty() || - currentSelection.startLineNumber !== currentSelection.endLineNumber; + let seedSearchStringFromSelection = !currentSelection.isEmpty() && + currentSelection.startLineNumber === currentSelection.endLineNumber; let oldSearchString = controller.getState().searchString; // if the existing search string in find widget is empty and we don't seed search string from selection, it means the Find Input // is still empty, so we should focus the Find Input instead of Replace Input. - let shouldFocus = !oldSearchString && seedSearchStringFromSelection ? - FindStartFocusAction.FocusFindInput : FindStartFocusAction.FocusReplaceInput; + let shouldFocus = (!!oldSearchString || seedSearchStringFromSelection) ? + FindStartFocusAction.FocusReplaceInput : FindStartFocusAction.FocusFindInput; if (controller) { controller.start({