summaryrefslogtreecommitdiff
path: root/scripts/prompt.scm
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/prompt.scm')
-rw-r--r--scripts/prompt.scm53
1 files changed, 25 insertions, 28 deletions
diff --git a/scripts/prompt.scm b/scripts/prompt.scm
index 3440b28..32e7606 100644
--- a/scripts/prompt.scm
+++ b/scripts/prompt.scm
@@ -3,35 +3,32 @@
(define prompt-text "")
(define (prompt-update)
- (let ((key-pressed (rl-get-key-pressed)))
-
-
- (if (eq? key-pressed KEY_F1)
- (set! prompt-active (not prompt-active))
- )
-
- (if prompt-active
- (begin
- (let ((key (rl-get-char-pressed)))
- (cond ((and (>= key 32) (<= key 125))
- (set! prompt-text
- (string-append prompt-text (string (integer->char key)))))
- ))
-
- (if (rl-is-key-down KEY_ENTER)
- (begin
- (eval-string prompt-text)
- (set! prompt-text "")
+ (if (eq? current-pressed-key KEY_F1)
+ (set! prompt-active (not prompt-active))
+ )
+
+ (if prompt-active
+ (begin
+ (let ((key (rl-get-char-pressed)))
+ (cond ((and (>= key 32) (<= key 125))
+ (set! prompt-text
+ (string-append prompt-text (string (integer->char key)))))
))
-
- (if (eq? key-pressed KEY_BACKSPACE)
- (let ((n (string-length prompt-text)))
- (cond ((>= n 1)
- (set! prompt-text (substring prompt-text 0 (- n 1))))
- )))
-
- ))
- )
+
+ (if (rl-is-key-down KEY_ENTER)
+ (begin
+ (eval-string prompt-text)
+ (set! prompt-text "")
+ ))
+
+ (if (eq? current-pressed-key KEY_BACKSPACE)
+ (let ((n (string-length prompt-text)))
+ (cond ((>= n 1)
+ (set! prompt-text (substring prompt-text 0 (- n 1))))
+ )))
+
+ ))
+
)
(define (prompt-draw)