This repository was archived by the owner on Dec 15, 2022. It is now read-only.
File tree 2 files changed +20
-3
lines changed
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
132
132
@subscriptions .add atom .commands .add ' atom-workspace' ,
133
133
' find-and-replace:use-selection-as-find-pattern' : @setSelectionAsFindPattern
134
134
135
+ @subscriptions .add atom .commands .add ' .preview-pane' ,
136
+ ' project-find:copy-search-results' : @copySearchResultFromPane
137
+
135
138
@subscriptions .add atom .commands .add @element ,
136
139
' find-and-replace:focus-next ' : => @ focusNextElement (1 )
137
140
' find-and-replace:focus-previous ' : => @ focusNextElement (- 1 )
@@ -143,9 +146,7 @@ class ProjectFindView extends View
143
146
' project-find:toggle-case-option ' : => @ toggleCaseOption ()
144
147
' project-find:toggle-whole-word-option ' : => @ toggleWholeWordOption ()
145
148
' 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 ()
149
150
150
151
updateInterfaceForSearching = =>
151
152
@ setInfoMessage (' Searching...' )
Original file line number Diff line number Diff line change @@ -742,6 +742,22 @@ describe 'ProjectFindView', ->
742
742
expect (resultsPaneView .previewCount .text ()).toBe " 13 results found in 2 files for items"
743
743
expect (projectFindView .errorMessages ).not .toBeVisible ()
744
744
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
+
745
761
it " only searches paths matching text in the path filter" , ->
746
762
spyOn (atom .workspace , ' scan' ).andCallFake -> Promise .resolve ()
747
763
projectFindView .pathsEditor .setText (' *.js' )
You can’t perform that action at this time.
0 commit comments