-
Notifications
You must be signed in to change notification settings - Fork 197
Allow Project Find Results to be copied to clipboard #764
base: master
Are you sure you want to change the base?
Conversation
lib/project-find-view.coffee
Outdated
@@ -183,6 +186,10 @@ class ProjectFindView extends View | |||
@updateReplaceAllButtonEnablement(@model.getResultsSummary()) | |||
@handleEventsForReplace() | |||
|
|||
copySearchResultFromPane: -> | |||
atom.clipboard.write(Util.parseSearchResult()) | |||
atom.notifications.addInfo('Search results are copied to clipboard') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
@@ -146,6 +146,9 @@ class ProjectFindView extends View | |||
'project-find:toggle-whole-word-option': => @toggleWholeWordOption() | |||
'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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-results
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Above part could be rewritten with plain DOM API to remove the space-pen
dependency with minimal effort. Might help with getting this merged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jerone that's good Idea and I will work on it.
@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.