I use a replacement decoration. In inline mode, cursor movement operations can enter the replacement; I have a View plugin which responds to transactions when the selection is inside the replacement decoration to allow editing there. This all works well in when I use an inline decoration; however, for my purpose (literate programming – I’m replacing a block of comments with a Markdown-rendered replacement), I need to use a block decoration, in which case the selection isn’t allowed to enter the block, unless I move past the block then left-arrow back into it.
Is there any way to get inline-line cursor movement with a block widget?
Selection can be inside the range covered by a block replacement, but the default vertical cursor motion commands won’t put it there. You might be able to use custom commands for arrow up/down keys that override the motion when near/in a widget. (Though implementing pixel-accurate vertical motion might be hard, since the lines inside the widget aren’t rendered by the editor, and things like posAtCoords won’t work on them.)
Thanks as always for a prompt and helpful reply. Since the default vertical cursor motion commands won’t allow a selection inside a block replacement (and I assume there’s no easy way to override this behavior), then changing keybindings does look like the best approach. Thanks again for pointing me in the right direction!