WiP: ensure_line_present now always replaces the whole line