lines += buf.count('\n')