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 @@ -134,6 +134,9 @@ class ProjectFindView extends View
134
134
@subscriptions .add atom .commands .add ' atom-workspace' ,
135
135
' find-and-replace:use-selection-as-find-pattern' : @setSelectionAsFindPattern
136
136
137
+ @subscriptions .add atom .commands .add ' .preview-pane' ,
138
+ ' project-find:copy-search-results' : @copySearchResultFromPane
139
+
137
140
@subscriptions .add atom .commands .add @element ,
138
141
' find-and-replace:focus-next ' : => @ focusNextElement (1 )
139
142
' find-and-replace:focus-previous ' : => @ focusNextElement (- 1 )
@@ -145,9 +148,7 @@ class ProjectFindView extends View
145
148
' project-find:toggle-case-option ' : => @ toggleCaseOption ()
146
149
' project-find:toggle-whole-word-option ' : => @ toggleWholeWordOption ()
147
150
' project-find:replace-all ' : => @ replaceAll ()
148
-
149
- @subscriptions .add atom .commands .add ' div.preview-pane' ,
150
- ' project-find:copy-search-results' : @copySearchResultFromPane
151
+ ' project-find:copy-search-results ' : => @ copySearchResultFromPane ()
151
152
152
153
updateInterfaceForSearching = =>
153
154
@ setInfoMessage (' Searching...' )
Original file line number Diff line number Diff line change @@ -704,6 +704,22 @@ describe 'ProjectFindView', ->
704
704
expect (resultsPaneView .previewCount .text ()).toBe " 13 results found in 2 files for items"
705
705
expect (projectFindView .errorMessages ).not .toBeVisible ()
706
706
707
+ it " can copy search results to clipboard" , ->
708
+ oldClipboardText = atom .clipboard .read ()
709
+ atom .commands .dispatch (projectFindView[0 ], ' core:confirm' )
710
+
711
+ waitsForPromise ->
712
+ searchPromise
713
+
714
+ runs ->
715
+ atom .commands .dispatch (projectFindView[0 ], ' project-find:copy-search-results' )
716
+ searchResults = atom .clipboard .read ().split (' \n ' )
717
+ expect (searchResults[0 ]).toBe " 13 results found in 2 files for items"
718
+ expect (searchResults[2 ]).toBe " sample.coffee (7)"
719
+ expect (searchResults[3 ]).toBe " \t 2\t sort: (items) ->"
720
+ expect (searchResults[4 ]).toBe " \t 3\t return items if items.length <= 1"
721
+ atom .clipboard .write oldClipboardText
722
+
707
723
it " only searches paths matching text in the path filter" , ->
708
724
spyOn (atom .workspace , ' scan' ).andCallFake -> Promise .resolve ()
709
725
projectFindView .pathsEditor .setText (' *.js' )
You can’t perform that action at this time.
0 commit comments