Index: parley.scm =================================================================== --- parley.scm (revision 26515) +++ parley.scm (working copy) @@ -147,8 +147,10 @@ ( move-forward . ,(lambda (n) (sprintf "\x1b[~aC" n))) ( move-backward . ,(lambda (n) (sprintf "\x1b[~aD" n))) ( move-to-col . ,(lambda (col) (sprintf "\x1b[~aG" col))) + ( move-to . ,(lambda (row col) (sprintf "\x1b[~a;~aH" row col))) ( save-position . ,(lambda () "\x1b[s")) - ( restore-position . ,(lambda () "\x1b[u")))) + ( restore-position . ,(lambda () "\x1b[u")) + ( erase-screen . ,(lambda (n) (sprintf "\x1b[~aJ" n))))) (define (esc-seq name) (cond ((alist-ref name +esc-sequences+) => @@ -294,7 +296,7 @@ (list prompt in out line pos exit offset))) (discard-and-restart . ,(lambda (prompt in out line pos exit offset) - (list prompt in out "" 0 exit offset))) + (list prompt in out "" 0 exit 0))) (delete-curr-char . ,(lambda (prompt in out line pos exit offset) (if (> pos 0) @@ -354,7 +356,11 @@ (cond ((escape-sequence-handler-ref (get-complete-esc-sequence in)) => (lambda (handler) (handler prompt in out line pos exit offset))) - (else (list prompt in out line pos exit offset))))))) + (else (list prompt in out line pos exit offset))))) + (erase-screen . ,(lambda (prompt in out line pos exit offset) + (display ((esc-seq 'erase-screen) 2) out) + (display ((esc-seq 'move-to) 1 1) out) + (list prompt in out line pos exit offset))))) (define (handle event) (cond ((alist-ref event +key-handlers+) => @@ -365,7 +371,8 @@ `((#\x43 . ,(handle 'right-arrow)) (#\x44 . ,(handle 'left-arrow)) (#\x41 . ,(handle 'prev-history)) - (#\x42 . ,(handle 'next-history)))) + (#\x42 . ,(handle 'next-history)) + (#\x4a . ,(handle 'erase-screen)))) (define (escape-sequence-handler-ref seq) (and seq (or (alist-ref seq user-esc-sequences) @@ -439,6 +446,8 @@ (handle 'escape-sequence)) ((#\xb) (handle 'delete-until-eol)) + ((#\xc) + (handle 'erase-screen)) ((#\x1) (handle 'jump-to-start-of-line)) ((#\x5)