diff options
-rw-r--r-- | par/piece-table.scm | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/par/piece-table.scm b/par/piece-table.scm index f5f58da..c1688a2 100644 --- a/par/piece-table.scm +++ b/par/piece-table.scm @@ -398,8 +398,9 @@ ;; Interact with lines: interesting for the UI (define (piece-table-line piece-table line-number) (let ((start (if (= line-number 0) 0 - (+ 1 (piece-table-find-line-break piece-table - (- line-number 1))))) + (let ((line (piece-table-find-line-break piece-table + (- line-number 1)))) + (if (eof-object? line) line (+ 1 line))))) (end (piece-table-find-line-break piece-table line-number))) (cond ((eof-object? start) start) |