diff --git a/scheme/input-buffer.scm b/scheme/input-buffer.scm index fcf6bd1..993a8cc 100644 --- a/scheme/input-buffer.scm +++ b/scheme/input-buffer.scm @@ -356,11 +356,13 @@ (lambda (num-cols pos-col line) (let* ((lines (ceiling (/ (string-length line) num-cols))) (end-pos (* lines num-cols))) - (let loop ((offset 0) - (end end-pos)) - (if (< (+ end 2) pos-col) - (- offset 1) - (loop (+ offset 1) (- end num-cols))))))) + (if (= (string-length line) 0) + 0 + (let loop ((offset 0) + (end end-pos)) + (if (<= (+ end 2) pos-col) + (- offset 1) + (loop (+ offset 1) (- end num-cols))))))))