Fix bug that resulted from mucking with line ranges.

Partial fix for #205. Still needs a solution in order to restore folds
after we've trimmed all the lines.