Fixed up the scrolling code.
Explicitly reset @line_num to -1 at the beginning of show to avoid display issues.