update
This commit is contained in:
parent
2bccde988d
commit
29c62c8569
7
Makefile
7
Makefile
|
@ -1,6 +1,6 @@
|
|||
.PHONY: load clean
|
||||
.PHONY: load clean run
|
||||
|
||||
white-tiger:
|
||||
white-tiger: src/white-tiger.lisp
|
||||
sbcl \
|
||||
--eval '(require "asdf")' \
|
||||
--eval '(asdf:load-asd (merge-pathnames "white-tiger.asd" (uiop:getcwd)))' \
|
||||
|
@ -13,5 +13,8 @@ load:
|
|||
--eval '(asdf:load-asd (merge-pathnames "white-tiger.asd" (uiop:getcwd)))' \
|
||||
--eval '(asdf:load-system :white-tiger)'
|
||||
|
||||
run: white-tiger
|
||||
./white-tiger
|
||||
|
||||
clean:
|
||||
rm -f white-tiger
|
||||
|
|
|
@ -1,34 +1,10 @@
|
|||
(defpackage white-tiger
|
||||
(:use :cl :cl-tui)
|
||||
(:use :cl)
|
||||
(:export #:start))
|
||||
|
||||
(in-package white-tiger)
|
||||
|
||||
(define-frame log (log-frame) :on :root)
|
||||
;; edit-frame implements a single-line text editor. It will misbehave if its height is not 1
|
||||
(define-frame input (edit-frame :prompt "> ") :on :root :h 1)
|
||||
|
||||
(defun finish-input ()
|
||||
;; Get text from edit-frame
|
||||
(let ((text (get-text 'input)))
|
||||
;; Append it to the log-frame
|
||||
(append-line 'log text)
|
||||
;; And clear the text in edit-frame
|
||||
(clear-text 'input)))
|
||||
|
||||
(defun start ()
|
||||
(with-screen ()
|
||||
(set-split-type :root :vertical)
|
||||
(append-line 'log "Enter some text.")
|
||||
(append-line 'log "Esc to quit")
|
||||
(loop
|
||||
(refresh)
|
||||
(let ((key (read-key)))
|
||||
(case key
|
||||
;; Esc and Newline are handled here
|
||||
(#\Esc (return))
|
||||
(#\Newline (finish-input))
|
||||
(:key-up (cl-tui:scroll-log 'log 1))
|
||||
(:key-down (cl-tui:scroll-log 'log -1))
|
||||
;; Everything else is sent to the edit-frame.
|
||||
(t (handle-key 'input key)))))))
|
||||
(defun start () t)
|
||||
|
||||
|
|
|
@ -4,4 +4,4 @@
|
|||
:license "AGPL-3.0"
|
||||
:pathname "src/"
|
||||
:components ((:file "white-tiger"))
|
||||
:depends-on (cl-tui))
|
||||
:depends-on (parsnip))
|
||||
|
|
Loading…
Reference in New Issue