Handle process and terminal correctly.
This commit is contained in:
parent
74afca1354
commit
2232786316
3 changed files with 14 additions and 5 deletions
|
@ -225,7 +225,7 @@ WEB-STATIC-SOURCES=web-static.scm member-record.import.scm \
|
||||||
web-static.o: web-static.import.scm
|
web-static.o: web-static.import.scm
|
||||||
web-static.import.scm: $(WEB-STATIC-SOURCES)
|
web-static.import.scm: $(WEB-STATIC-SOURCES)
|
||||||
|
|
||||||
ENVIRONMENT-SOURCES=environment.scm
|
ENVIRONMENT-SOURCES=environment.scm ansi.import.scm
|
||||||
|
|
||||||
environment.o: environment.import.scm
|
environment.o: environment.import.scm
|
||||||
environment.import.scm: $(ENVIRONMENT-SOURCES)
|
environment.import.scm: $(ENVIRONMENT-SOURCES)
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
ansi-string-length
|
ansi-string-length
|
||||||
ansi-paragraph-format
|
ansi-paragraph-format
|
||||||
ansi-string
|
ansi-string
|
||||||
|
clrscr
|
||||||
ansi-tests!
|
ansi-tests!
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -211,6 +212,11 @@
|
||||||
(cons arg res)
|
(cons arg res)
|
||||||
(cons arg (cons (apply ansi (reverse kws)) res))))))))))
|
(cons arg (cons (apply ansi (reverse kws)) res))))))))))
|
||||||
|
|
||||||
|
;; Clears the entire screen and positions cursor in the upper-left
|
||||||
|
;; corner.
|
||||||
|
(define (clrscr)
|
||||||
|
(display "\x1b[0m\x1b[2J\x1b[0;0H"))
|
||||||
|
|
||||||
;; Performs ANSI module self-tests.
|
;; Performs ANSI module self-tests.
|
||||||
(define (ansi-tests!)
|
(define (ansi-tests!)
|
||||||
(run-tests
|
(run-tests
|
||||||
|
|
|
@ -34,14 +34,17 @@
|
||||||
(import scheme
|
(import scheme
|
||||||
(chicken base)
|
(chicken base)
|
||||||
(chicken process-context)
|
(chicken process-context)
|
||||||
(chicken process))
|
(chicken process)
|
||||||
|
ansi)
|
||||||
|
|
||||||
;; Starts an editor on given file
|
;; Starts an editor on given file
|
||||||
(define (edit-file file-path)
|
(define (edit-file file-path)
|
||||||
(print "Editing...")
|
(print "Editing...")
|
||||||
(let* ((edvar (get-environment-variable "EDITOR"))
|
(let* ((edvar (get-environment-variable "EDITOR"))
|
||||||
(editor (or edvar "editor")))
|
(editor (or edvar "editor"))
|
||||||
(process-run editor (list file-path))
|
(pid (process-run editor (list file-path))))
|
||||||
))
|
(process-wait pid)
|
||||||
|
(clrscr)
|
||||||
|
(flush-output)))
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue