Created
May 16, 2017 16:40
-
-
Save t9md/57563bd0e8eff94f61d99569adc099c9 to your computer and use it in GitHub Desktop.
atom-narrow start-search-by-double-click
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
startNarrow = (element, event) -> | |
{detail, shiftKey, metaKey, ctrlKey} = event | |
# console.log [shiftKey, metaKey, ctrlKey] | |
if detail is 2 | |
# if detail is 2 # double-click | |
event.stopPropagation() | |
event.preventDefault() | |
if atom.workspace.getElement().classList.contains('has-narrow') | |
command = 'narrow:query-current-word' | |
else | |
command = 'narrow:search-by-current-word-without-focus' | |
atom.commands.dispatch(element, command) | |
atom.workspace.observeTextEditors ({element}) -> | |
onMouseDown = startNarrow.bind(null, element) | |
element.addEventListener('mousedown', onMouseDown, true) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment