Allow Project Find Results to be copied to clipboard#764
Allow Project Find Results to be copied to clipboard#764liuderchi wants to merge 1 commit intoatom:masterfrom
Conversation
lib/project-find-view.coffee
Outdated
|
|
||
| copySearchResultFromPane: -> | ||
| atom.clipboard.write(Util.parseSearchResult()) | ||
| atom.notifications.addInfo('Search results are copied to clipboard') |
There was a problem hiding this comment.
Search results have been copied to clipboard
|
Very nice! Left you a few comments to resolve the lint errors. |
lib/project-find-view.coffee
Outdated
| 'project-find:replace-all': => @replaceAll() | ||
|
|
||
| @subscriptions.add atom.commands.add 'div.preview-pane', | ||
| 'project-find:copy-search-result': @copySearchResultFromPane |
There was a problem hiding this comment.
I will update this in menus/find-and-replace.cson also.
|
@50Wliu is there anything else I need to change? 😃 |
|
/cc @maxbrunsfeld |
0be3188 to
64e8a5c
Compare
lib/project/util.coffee
Outdated
| preview = $('span.preview', this).text() | ||
| searchResult.push '\t' + lineNumber + '\t' + preview | ||
| searchResult.push '' | ||
| searchResult.join('\n') |
There was a problem hiding this comment.
Above part could be rewritten with plain DOM API to remove the space-pen dependency with minimal effort. Might help with getting this merged.
|
@50Wliu how do think about the format of copied content? Also I guess spec for this feature is a nice-to-have. |
24d2f35 to
9cd6ca7
Compare
1d5b38c to
a6c9eb9
Compare
|
@50Wliu @jerone this PR now is
Anything else I can help? |
|
I don't feel qualified to review this PR, but I'll try to get someone else to take a look at it. |
|
Who has context top review this? Would love this feature. |
a6c9eb9 to
8aa9601
Compare
- add parseSearchResult() in util.coffee with DOM api - add copySearchResultFromPane() in project-find-view.js - add spec in project-find-view-spec.js - add context-menu item
8aa9601 to
4841893
Compare
|
currently project-find results page shows only visible items in DOM tree. so this PR cannot parse all search results from DOM as long as search results exceed the page view. |
|
@steveoh too bad this PR does not fit the view in current version. |
Related issue #416.
copy result of Project-Find to clipboard.
changes:
Util.copySearchResultFromPane()to copy text from search result pane(of course can use it via command-palette)
demo:

NOTE: hidden entries under collapsed item are not copied to clipboard so that result is consistent with view.