Update caret position manually

Having a fluid width alongside lineWrapping(ext), and the caret having an absolute position, when i resize my window, i need to update(or better say, fix) the position of the caret. Pressing a directional key also has a positive effect on recalculating the correct position. so maybe i can use this as a starting point.

I m pretty sure i haven’t searched properly, but can i get a pointer on how i can refresh the caret’s position imperatively?(maybe have a look at what an arrow key does to update the caret, or simply having to build a transaction that would move the selection)


Have you tried view.requestMeasure()? That should notify the selection-drawing extension that the editor’s geometry changed, causing it to redraw the selection.

Thanks, @marijn , will try!

Tried with requestMeasure and the caret still doesn’t reposition.

Can you reduce what you’re doing to a minimal script that allows me to reproduce this?

hmm, ok, will try!

couldn’t actually come up with a repro, so for now i m ok with dispatching a ({ selection: view.state.selection }) transaction.

Thanks for your time, @marijn