How can I get selectionStart/selectionEnd

Hello everyone.
Can someone help me find the way how can I get cursor position inside textarea ?
I mean I need an equivalent of selectionStart/selectionEnd properties like in pure textarea element.

I saw before Selection Change event, but ranges aren’t symbol number of my cursor or my selection.

Please help. I’m using 5 version of CM

Use getCursor or listSelections.

In these methods I get number of character and number of line. But I need number of all characters from start if it is click. And number of all characters from start and number of characters from end if it is selection

Is it possible to count number of all characters from start and end using method getCursor or listSelections ?

I solved this problem with cm.doc.eachLine method and counting number of characters in each line… I think it’s not better solution.