Rectangular selection with the keyboard

Hello,

rectangular selection works fine with the mouse.
But if I select the block with the keyboard (holding shift + right arrow key) and the selection exceeds the line’s length, it jumps at the beginning of the line after the last line of the block.

Linux + Chrome/Firefox + CM 5.51.0

Is this expected or issue? If expected, is there a way to avoid it and restrict the selection to the lines of the block (as it happens with the mouse)?

Thanks

More precisely:

it does the same behavior of the mouse if I use the keyboard in the way I explained but while pressing the Alt key.

It does the unwanted behavior if I set the rectangle selection by code:
txtEditor.setOption(“configureMouse”, function() { return {unit: “rectangle”} })

Rectangular selection is only implemented for the mouse at the moment. It’d be interesting to provide a keyboard implementation, but that’s not something I’ve looked at. It should be doable as an extension, outside of the core library.

Thanks.

It would be enough a workaround that forces the selection to not go outside the lines it belongs to.

Could I use the following approach?

txtEditor.on(“beforeSelectionChange”, function(e, range) {
… do something with range or range.ranges[0].head …
})

That’d be something very different from rectangular selection, though (which creates a number of selection ranges that together form a rectangle).

But yes, beforeSelectionChange can be used to filter selections.