Midi note length within region question

For that specific example, you could use the “Sizing Applies Time Stretch” mode of the Object Selection tool.

Cubase12_DWDQoE1lXB

For more general note trimming, this Macro works well: