Fix chomp and read_lines

Implements the POLA behavior of reading lines.

I might have to wait that #932 is merged before integrating this one.

Close #974 and close #975 (see them for details)