Skip to content

Commit

Permalink
Merge pull request #109762 from microsoft/rebornix/ctrl-e-regression
Browse files Browse the repository at this point in the history
cmd+e on empty selection should feed the word under cursor to find input
  • Loading branch information
rebornix authored Oct 30, 2020
2 parents 9072f17 + dbe1475 commit 3f5f747
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/vs/editor/contrib/find/findController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ export function getSelectionSearchString(editor: ICodeEditor, seedSearchStringFr
const selection = editor.getSelection();
// if selection spans multiple lines, default search string to empty

if (seedSearchStringFromSelection === 'single' && selection.startLineNumber === selection.endLineNumber) {
if (
(seedSearchStringFromSelection === 'single' && selection.startLineNumber === selection.endLineNumber)
|| seedSearchStringFromSelection === 'multiple'
) {
if (selection.isEmpty()) {
const wordAtPosition = editor.getConfiguredWordAtPosition(selection.getStartPosition());
if (wordAtPosition) {
Expand All @@ -49,10 +52,6 @@ export function getSelectionSearchString(editor: ICodeEditor, seedSearchStringFr
return editor.getModel().getValueInRange(selection);
}
}
} else if (seedSearchStringFromSelection === 'multiple') {
if (editor.getModel().getValueLengthInRange(selection) < SEARCH_STRING_MAX_LENGTH) {
return editor.getModel().getValueInRange(selection);
}
}

return null;
Expand Down

0 comments on commit 3f5f747

Please sign in to comment.