pub fn count_lines(s: &str) -> u32
Count newlines in a string to determine the current 1-based line number. The line after the last newline is the current line being written.