read_line: correctly detect newline/enter char

Additional fixes for #19.