summaryrefslogtreecommitdiff
path: root/starling/kernel.scm
diff options
context:
space:
mode:
Diffstat (limited to 'starling/kernel.scm')
-rw-r--r--starling/kernel.scm18
1 files changed, 15 insertions, 3 deletions
diff --git a/starling/kernel.scm b/starling/kernel.scm
index e6658ca..23d1bad 100644
--- a/starling/kernel.scm
+++ b/starling/kernel.scm
@@ -133,7 +133,8 @@
(default-viewport #:accessor default-viewport)
(avg-frame-time #:accessor avg-frame-time #:init-form 0.0)
(controllers #:accessor controllers #:init-thunk make-hash-table)
- (repl #:accessor repl))
+ (repl #:accessor repl)
+ (minibuffer #:accessor minibuffer))
(define current-kernel (make-parameter #f))
@@ -172,6 +173,10 @@
(make <repl>
#:name 'repl
#:scene-mux kernel))
+ (set! (minibuffer kernel)
+ (make <minibuffer>
+ #:name 'minibuffer
+ #:scene-mux kernel))
(run-script kernel
(forever
(sleep 60)
@@ -180,7 +185,7 @@
(define-method (on-key-press (kernel <kernel>) key modifiers repeat?)
;; Hot keys when in dev mode
(if (and developer-mode?
- (not (or (eq? (current-scene kernel) (& kernel minibuffer))
+ (not (or (eq? (current-scene kernel) (minibuffer kernel))
(eq? (current-scene kernel) (repl kernel)))))
(match key
('backquote
@@ -190,7 +195,14 @@
('x
(if (or (memq 'left-alt modifiers)
(memq 'right-alt modifiers))
- (open-minibuffer kernel)
+ ;; We need to delay the minibuffer by one frame so that
+ ;; the text input event for the "x" character (part of
+ ;; the M-x key shortcut) is not processed by the
+ ;; minibuffer, thus adding an "x" to the user text entry
+ ;; area before the user has actually typed anything.
+ (run-script kernel
+ (sleep 1)
+ (open-minibuffer (minibuffer kernel)))
(next-method)))
('escape (abort-game))
(_ (next-method)))