diff options
-rw-r--r-- | par/piece-table.scm | 6 | ||||
-rw-r--r-- | par/piece-table.sld | 3 |
2 files changed, 5 insertions, 4 deletions
diff --git a/par/piece-table.scm b/par/piece-table.scm index a9c9ef7..948286a 100644 --- a/par/piece-table.scm +++ b/par/piece-table.scm @@ -118,16 +118,16 @@ ((add-buffer? buffer) (add-buffer-string buffer)) ((ro-buffer? buffer) (ro-buffer-string buffer)))) -(define %DEFAULT-ADD-BUFFER-LENGTH 64) +(define add-buffer-length (make-parameter 100)) (define (make-add-buffer) - (%make-add-buffer (make-string %DEFAULT-ADD-BUFFER-LENGTH) 0)) + (%make-add-buffer (make-string (add-buffer-length)) 0)) (define (enlarge-add-buffer! add-buffer at-least) (let* ((str (add-buffer-string add-buffer)) (len (string-length str)) ; TODO: Better algo here? - (new (make-string (+ len at-least %DEFAULT-ADD-BUFFER-LENGTH)))) + (new (make-string (+ len at-least (add-buffer-length))))) (set-add-buffer-string! add-buffer new) (string-copy! new 0 str))) diff --git a/par/piece-table.sld b/par/piece-table.sld index 053b863..420175f 100644 --- a/par/piece-table.sld +++ b/par/piece-table.sld @@ -7,5 +7,6 @@ piece-table-insert! piece-table-delete! piece-table->string - string->piece-table) + string->piece-table + add-buffer-length) (include "piece-table.scm")) |