summaryrefslogtreecommitdiffstats
path: root/qp.scm
diff options
context:
space:
mode:
Diffstat (limited to 'qp.scm')
-rw-r--r--qp.scm9
1 files changed, 6 insertions, 3 deletions
diff --git a/qp.scm b/qp.scm
index 0bfbef2..1dedf66 100644
--- a/qp.scm
+++ b/qp.scm
@@ -80,14 +80,17 @@
(qp-string
(lambda (str room)
+ (define len (string-length str))
+ (define mid (quotient (- room 3) 2))
(cond
- ((>= (string-length str) room 3)
- (display (substring str 0 (- room 3)))
+ ((>= len room 3)
+ (display (substring str 0 (- room 3 mid)))
(display "...")
+ (display (substring str (- len mid) len))
room)
(else
(display str)
- (string-length str)))))
+ len))))
(qp-obj
(lambda (obj room)