Fix bug if buffer has only 1 line

next_line was not used and caused an error in buffers with only 1 line.  If adding it back in, add checks for single-line buffers or modify line.rb to range check.