about summary refs log tree commit diff stats
path: root/color-repl.mu
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-01-30 13:27:12 -0800
committerKartik K. Agaram <vc@akkartik.com>2015-01-30 13:27:12 -0800
commita79a17b93fb030a66ab04e99a4ef3c318707227e (patch)
tree8c657e08f0f791a81ea9d5c2478f8533da6fa513 /color-repl.mu
parent901efe360c151e128098154399960cbceb5174e1 (diff)
downloadmu-a79a17b93fb030a66ab04e99a4ef3c318707227e.tar.gz
684
Diffstat (limited to 'color-repl.mu')
-rw-r--r--color-repl.mu10
1 files changed, 9 insertions, 1 deletions
diff --git a/color-repl.mu b/color-repl.mu
index a9770073..2e126738 100644
--- a/color-repl.mu
+++ b/color-repl.mu
@@ -7,7 +7,7 @@
 
 ; abort continuation -> string
 (function read-expression [
-  (default-space:space-address <- new space:literal 30:literal)
+  (default-space:space-address <- new space:literal 60:literal)
   (abort:continuation <- next-input)
   (history:buffer-address <- next-input)  ; buffer of strings
   (result:buffer-address <- init-buffer 10:literal)  ; string to maybe add to
@@ -24,6 +24,14 @@
     (c:character <- $wait-for-key-from-host)
     (done?:boolean <- process-key default-space:space-address c:character)
   }
+  ; trim trailing newline in result (easier history management below)
+  { begin
+    (l:character <- last result:buffer-address)
+    (trailing-newline?:boolean <- equal l:character ((#\newline literal)))
+    (break-unless trailing-newline?:boolean)
+    (len:integer-address <- get-address result:buffer-address/deref length:offset)
+    (len:integer-address/deref <- subtract len:integer-address/deref 1:literal)
+  }
   ; test: 3<enter> => size of s is 2
   (s:string-address <- to-array result:buffer-address)
   (reply s:string-address)