rework linemode (fate #313156)