Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to convert absolute position to paragraph/column position? #1235

Open
PavelTurk opened this issue May 31, 2024 · 1 comment
Open

How to convert absolute position to paragraph/column position? #1235

PavelTurk opened this issue May 31, 2024 · 1 comment

Comments

@PavelTurk
Copy link
Contributor

Let's suppose I have var postion = this.textArea.getCaretPosition();. Could anyone say how I can get the paragraph/column position from position?

@PavelTurk PavelTurk changed the title How to convert absolute position paragraph/column position? How to convert absolute position to paragraph/column position? May 31, 2024
@Jugen
Copy link
Collaborator

Jugen commented May 31, 2024

You can use:

var pos = textArea.offsetToPosition( ndx, Bias.Backward );
var paragraph = pos.getMajor();
var charInParagraph = pos.getMinor();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants