Listening for click event on gutter row


#1

Similar to Event to listen for code folding/unfolding I want to know the row number when the gutter is clicked on. Looking at the Gutter docs/source there doesn’t appear to the ability to register a listener for Gutter events, however I notice that when you click on a row number in the gutter, the row highlights so there must be some event to listen for.


#2

You can probably listen to the gutter events with a library like dom-listener (so that you don’t need to get a reference to the gutter) and then you can use the screenPositionForPixelPosition method of the text editor element to get the row at mouse position:

https://github.com/atom/atom/blob/master/src/text-editor-element.coffee#L293

As for the listener on the gutter that selects the line on a clik, you can find it here:

https://github.com/atom/atom/blob/master/src/text-editor-component.coffee#L505-L510