Prevent cursor position before a widget at the start of a line

Is it possible to place a widget decoration at the start of a line in such a way that the cursor can only be positioned on the line after the widget, not before it?

I’ve tried setting inclusiveStart: true but the cursor is still allowed to be at the start of the line, and I’m not sure what else to try - the last resort would perhaps be a transaction filter which moves the selection forwards if it ends up on the wrong side of the widget.

A transaction filter is probably the best way to do this.

1 Like

Ok, thanks. I wonder whether the recent improvement to posAtCoords might make it possible to ask the nearest widget whether to use posAtStart or posAtEnd (or some other position)?

No, that’s not really something those changes do. And even if you could control the positions returned for coordinates on the widget, that wouldn’t solve the case of clicking to the left of it.

I was able to solve this using a transaction filter :+1: