Is there a way to judge the position when the cursor just at the end of of multiline paragraph?

I’m tring to using coordsAtPos function to get the info of the cursor positions. But I found an issue when I put the cursor at the end of a multiline paragraph (just after char l) like the image below showed:

and when I put the cursor at the second line just before char m it remained the same position:

Is there a way for me to distinguish between the two position? Cause coordsAtPos(39) may return two different possible value as expected. Any ideas will help.

No, ProseMirror represents selections as just document positions, without further information, and as such doesn’t distinguish between these two cursor positions.