about summary refs log tree commit diff stats
path: root/x.rkt
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-01-27 01:21:29 -0800
committerKartik K. Agaram <vc@akkartik.com>2015-01-27 01:21:29 -0800
commite5756fbef85f4ab29370da16ef533c770e0dabc2 (patch)
treec0c7fe1ed6a5b05ec7fd25d0db058ad1b32c21a9 /x.rkt
parent465007f11e5ccfede71e0afda44510eb1eae0ec7 (diff)
downloadmu-e5756fbef85f4ab29370da16ef533c770e0dabc2.tar.gz
638 - quick spike: syntax highlighting in repl
Backspace kinda works. Parens are colored in three rotating colors which
helps with balancing. Comments and strings are colored.

But it's hard to handle backspace in all situations. Like if you
backspace over a quote you have to either quit the string-slurping
routine you're in, or return to string slurping mode. Similarly for
comments; *there* you don't even have a end delimiter to let you know
you're back in a comment. You have to keep track of what came before.

I experimented with a library but it interacts poorly with the charterm
library I'm already using. Ended up with a gross inefficient approach
instead.
Diffstat (limited to 'x.rkt')
-rw-r--r--x.rkt14
1 files changed, 14 insertions, 0 deletions
diff --git a/x.rkt b/x.rkt
new file mode 100644
index 00000000..ef5ad28b
--- /dev/null
+++ b/x.rkt
@@ -0,0 +1,14 @@
+(require "charterm/main.rkt")
+(require "terminal-color/terminal-color/main.rkt")
+(open-charterm)
+(charterm-clear-screen)
+(charterm-cursor 5 5)
+(displayln-color "Hello" #:fg 'green)  ; works
+(charterm-cursor 25 5)
+(displayln-color " Hello" #:fg 'green)  ; works
+;? ;? (charterm-cursor 1 6) ;? 2
+;? ;? (display-color "Hello" #:fg 'green)  ; err: cursor moves to start of line ;? 1
+;? (charterm-newline)  ; doesn't work after display; somehow runs before it ;? 1
+;? ;? (charterm-clear-line) ;? 3
+;? (displayln-color "World" #:fg 'green) ;? 1
+(close-charterm)