I think I have a general misunderstanding of ranges from selection and often end up confusing the two. That said, here’s my problem: I want to detect once a selected text in an editor pane has been deselected.
# pre-requisites editor = atom.workspace.getActiveTextEditor(); selection = editor.getLastSelection() console.log selection.getText()
All of the above works fine, it logs the text of the selection to the console. So, let’s go ahead.
editor.onDidChangeSelectionRange detects whenever I’m changing the selection (as the name suggests), but it always seems to be a step behind. Judging by its name, I should be using
onDidRemoveSelection in the first place. The problem is, that the following never logs anything.
editor.onDidRemoveSelection () -> console.log "Cuckoo!"
What am I doing wrong?