Multi-line input with buffer