;; -*- Mode: Irken -*- (require "lib/basis.scm") ;; can we slap together a quick line editor using ANSI/vt100 escape sequences? ;; what's the minimum necessary? ;; let's start with just backspace. ;; then move on to cursor positioning. (define (line-edit read write) ;; let's try a progress bar. (for-range i 100 (timeq/sleep 50) (let ((width (/ (+ i 1) 4)) (bar (format "[" (repeat width "*") (repeat (- 25 width) " ") "]"))) (printf ".") (flush) ;;(write (format "\x1b[1000D" bar)) (write (format "\r" bar)) )) (let loop ((line (list:nil)) (data (read))) (write data) (loop line (read)) ) )