Fix line clearing to take the line return event into account