Get position of mouse pointer in TextEditorView


#1

Is it possible to get the position of the mouse pointer in a TextEditorView in some way? I’m thinking of using it in a TextEditorView to show the Point in the buffer the mouse pointer is pointing at. I can obviously use .onmousemove() and getBoundingClientRect() to play around with coordinates of the mouse, and that works ok with monospace text, but there’s no way to get the appropriate point under cursor with non-monospace fonts. Is there an API I’m not aware of for accessing point under mouse for a TextEditorView?


#2

Currently, Atom doesn’t properly support proportional-width fonts in TextEditor views. So, for now, you shouldn’t have to worry about it.


#3

Are you sure? Atom font selection was broken in a version some time ago and I used it with the default proportional font. I was surprised that it worked and there were some nice things about the experience. I probably just missed the problems by coincidence.


#4

Huh, I just tried it and yeah … it works much better than it used to. I wonder when they added that! :laughing: