Updated ExpandToLine, JoinLines, and InvertSelection based on feedback.