read_line: correctly detect newline/enter char