How to scroll to character X on a long line?

I am pasting a long line, and I want to be able to scroll to character X without providing pixels horizontal location of that character.

I found

view.scrollDOM.scroll(x, 1);

but I only know the character number not its location it self, any idea ?

The EditorView.scrollIntoView effect should be able to do that.

Thanks, can you provide any example how to call it?

view.dispatch({effects: EditorView.scrollIntoView(...)})

1 Like

Thank you!