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 @@ -134,6 +134,9 @@ class ProjectFindView extends View
134134 @subscriptions .add atom .commands .add ' atom-workspace' ,
135135 ' find-and-replace:use-selection-as-find-pattern' : @setSelectionAsFindPattern
136136
137+ @subscriptions .add atom .commands .add ' .preview-pane' ,
138+ ' project-find:copy-search-results' : @copySearchResultFromPane
139+
137140 @subscriptions .add atom .commands .add @element ,
138141 ' find-and-replace:focus-next ' : => @ focusNextElement (1 )
139142 ' find-and-replace:focus-previous ' : => @ focusNextElement (- 1 )
@@ -145,9 +148,7 @@ class ProjectFindView extends View
145148 ' project-find:toggle-case-option ' : => @ toggleCaseOption ()
146149 ' project-find:toggle-whole-word-option ' : => @ toggleWholeWordOption ()
147150 ' 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 ()
151152
152153 updateInterfaceForSearching = =>
153154 @ setInfoMessage (' Searching...' )
Original file line number Diff line number Diff line change @@ -704,6 +704,22 @@ describe 'ProjectFindView', ->
704704 expect (resultsPaneView .previewCount .text ()).toBe " 13 results found in 2 files for items"
705705 expect (projectFindView .errorMessages ).not .toBeVisible ()
706706
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+
707723 it " only searches paths matching text in the path filter" , ->
708724 spyOn (atom .workspace , ' scan' ).andCallFake -> Promise .resolve ()
709725 projectFindView .pathsEditor .setText (' *.js' )
You can’t perform that action at this time.
0 commit comments