- // Has the user requested we not justify stuff?
- if (!bv_->buffer().params().justification
- && align == LYX_ALIGN_BLOCK)
- align = LYX_ALIGN_LEFT;
+ if (align == LYX_ALIGN_BLOCK) {
+ // If this row has been broken abruptly by a display inset, or
+ // it is the end of the paragraph, or the user requested we
+ // not justify stuff, then don't stretch.
+ // A forced block alignment can only be overridden the 'no
+ // justification on screen' setting.
+ if (((row.right_boundary() || row.endpos() == par.size())
+ && !forced_block)
+ || !bv_->buffer().params().justification)
+ align = text_->isRTL(par) ? LYX_ALIGN_RIGHT : LYX_ALIGN_LEFT;
+ }