- ## jump to the left column
- ideal_left = left +
- if loose_alignment
- -IDEAL_LEFT_CONTEXT + (l.width - buffer.content_width + IDEAL_LEFT_CONTEXT + 1).clamp(0, IDEAL_LEFT_CONTEXT)
- else
- 0
- end
-
- jump_to_col [ideal_left, 0].max
+ ## calculate leftmost colum
+ left = if force_alignment # force mode: align exactly
+ message_left
+ else # regular: minimize cursor movement
+ ## leftmost and rightmost are boundaries of all valid left-column
+ ## alignments.
+ leftmost = [message_left, message_right - buffer.content_width + 1].min
+ rightmost = message_left
+ leftcol.clamp(leftmost, rightmost)
+ end