Find out where on TextField context menu appears

I want users to be able to right click on a certain line in the text field, and I don’t want to go through the hassle and extra memory and coding involved in breaking up the field.

If the user has not selected the textField yet, right clicking will set the “caretIndex” to the correct value, however, if the field is in focus when they right click, the carrotIndex will not display the correct value, but will display the selection value.

How can I detect which line/character was right clicked? Is it even possible to get the coordinates of the right click without needing to resort to detecting MOUSE_MOVE and updating some sort of global value each time?