diff options
author | Ekaitz Zarraga <ekaitz@elenq.tech> | 2024-02-13 22:14:48 +0100 |
---|---|---|
committer | Ekaitz Zarraga <ekaitz@elenq.tech> | 2024-02-13 22:14:48 +0100 |
commit | d088ae8cb747ad3a12b243f7ea731cd87fdffaed (patch) | |
tree | 8d5c2029818b5b45ad884bc495923763cb83f2d2 | |
parent | 418d9f8343ff8f4528bb3341fc0c577f33269006 (diff) |
par: piece-table: make piece-table-line work with wrong lines
-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) |