Get cursor position related to line

Hey there,

I have a use case which I need to know what is the cursor position related to the line.

Today I get the cursor offset from start of the doc, I need to get the offset from start of line.

Any ideas?

Find the line around the cursor (line = state.doc.lineAt(cursorPos)) and compare to line.from.

1 Like

Awesome, Exactly what I was looking for.

Thanks! :pray: