This repository was archived by the owner on Dec 15, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -132,6 +132,9 @@ class ProjectFindView extends View
132132 @subscriptions .add atom .commands .add ' atom-workspace' ,
133133 ' find-and-replace:use-selection-as-find-pattern' : @setSelectionAsFindPattern
134134
135+ @subscriptions .add atom .commands .add ' .preview-pane' ,
136+ ' project-find:copy-search-results' : @copySearchResultFromPane
137+
135138 @subscriptions .add atom .commands .add @element ,
136139 ' find-and-replace:focus-next ' : => @ focusNextElement (1 )
137140 ' find-and-replace:focus-previous ' : => @ focusNextElement (- 1 )
@@ -143,9 +146,7 @@ class ProjectFindView extends View
143146 ' project-find:toggle-case-option ' : => @ toggleCaseOption ()
144147 ' project-find:toggle-whole-word-option ' : => @ toggleWholeWordOption ()
145148 ' project-find:replace-all ' : => @ replaceAll ()
146-
147- @subscriptions .add atom .commands .add ' div.preview-pane' ,
148- ' project-find:copy-search-results' : @copySearchResultFromPane
149+ ' project-find:copy-search-results ' : => @ copySearchResultFromPane ()
149150
150151 updateInterfaceForSearching = =>
151152 @ setInfoMessage (' Searching...' )
Original file line number Diff line number Diff line change @@ -742,6 +742,22 @@ describe 'ProjectFindView', ->
742742 expect (resultsPaneView .previewCount .text ()).toBe " 13 results found in 2 files for items"
743743 expect (projectFindView .errorMessages ).not .toBeVisible ()
744744
745+ it " can copy search results to clipboard" , ->
746+ oldClipboardText = atom .clipboard .read ()
747+ atom .commands .dispatch (projectFindView[0 ], ' core:confirm' )
748+
749+ waitsForPromise ->
750+ searchPromise
751+
752+ runs ->
753+ atom .commands .dispatch (projectFindView[0 ], ' project-find:copy-search-results' )
754+ searchResults = atom .clipboard .read ().split (' \n ' )
755+ expect (searchResults[0 ]).toBe " 13 results found in 2 files for items"
756+ expect (searchResults[2 ]).toBe " sample.coffee (7)"
757+ expect (searchResults[3 ]).toBe " \t 2\t sort: (items) ->"
758+ expect (searchResults[4 ]).toBe " \t 3\t return items if items.length <= 1"
759+ atom .clipboard .write oldClipboardText
760+
745761 it " only searches paths matching text in the path filter" , ->
746762 spyOn (atom .workspace , ' scan' ).andCallFake -> Promise .resolve ()
747763 projectFindView .pathsEditor .setText (' *.js' )
You can’t perform that action at this time.
0 commit comments