Skip to content

Commit

Permalink
Start search with selected text.
Browse files Browse the repository at this point in the history
Closes #2
  • Loading branch information
mkleehammer committed Jul 31, 2014
1 parent 89f0c75 commit 2ae9ddc
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/input-view.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ class InputView extends View
@command 'incremental-search:toggle-case-option', @toggleCaseOption

@searchModel.on 'updatedOptions', =>
console.log('got event')
@updateOptionButtons()
@updateOptionsLabel()

Expand Down Expand Up @@ -101,8 +100,11 @@ class InputView extends View
if initial
# The model keeps track of where the search started. If we haven't done that yet
# then we are starting a new search.
@findEditor.setText('');
@searchModel.start('')
#
# If there is a selection, use it.
pattern = atom.workspace.getActivePaneItem()?.getSelectedText() || ''
@findEditor.setText(pattern);
@searchModel.start(pattern)
else if @findEditor.getText()
# We already have text in the box, so search for the next item
@searchModel.findNext()
Expand Down

0 comments on commit 2ae9ddc

Please sign in to comment.