menu/text files were truncated when > 200 lines - clic - Clic is an command lin… | |
git clone git://bitreich.org/clic/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65… | |
Log | |
Files | |
Refs | |
Tags | |
README | |
LICENSE | |
--- | |
commit 26a0eee532a51e2d82d31e7b8e791c34b1cc7cde | |
parent 8e4fb9b8579b02bd71c70cc83492ce2a39f18f54 | |
Author: Solene Rapenne <[email protected]> | |
Date: Thu, 31 May 2018 13:36:15 +0200 | |
menu/text files were truncated when > 200 lines | |
Diffstat: | |
M clic.lisp | 8 ++++++-- | |
1 file changed, 6 insertions(+), 2 deletions(-) | |
--- | |
diff --git a/clic.lisp b/clic.lisp | |
@@ -96,7 +96,7 @@ | |
(defun copy-array(from) | |
"return a new array containing the same elements as the parameter" | |
- (let ((dest (make-array 200 | |
+ (let ((dest (make-array (length from) | |
:fill-pointer 0 | |
:initial-element nil | |
:adjustable t))) | |
@@ -297,8 +297,12 @@ | |
;; not binary | |
;; for each line we receive we store it in *buffer* | |
(loop for line = (read-line stream nil nil) | |
+ count line into lines | |
while line | |
do | |
+ ;; increase array size if needed | |
+ (when (= lines (- (array-total-size *buffer*) 1)) | |
+ (adjust-array *buffer* (+ 200 (array-total-size *buffer*)))) | |
(vector-push line *buffer*))) | |
;; we store the duration of the connection | |
@@ -322,7 +326,7 @@ | |
(defun filter-line(text) | |
"display only lines containg text" | |
(setf *previous-buffer* (copy-array *buffer*)) | |
- (setf *buffer* (make-array 200 | |
+ (setf *buffer* (make-array 400 | |
:fill-pointer 0 | |
:initial-element nil | |
:adjustable t)) |