diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-07-07 14:40:14 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-07-07 14:42:46 -0700 |
commit | 25a033d8cf9c9c388e5b2b42468a72e2295544ed (patch) | |
tree | 67b7df65a27afa22aed67f3670ffcca0a50f5c8c | |
parent | 9d85e1d2f81234a6b7bc512fceb837f72fc9fa9e (diff) | |
download | mu-25a033d8cf9c9c388e5b2b42468a72e2295544ed.tar.gz |
1719 - start using configurable event-handler
-rw-r--r-- | edit.mu | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/edit.mu b/edit.mu index f49b5d0e..17291090 100644 --- a/edit.mu +++ b/edit.mu @@ -94,9 +94,9 @@ container editor-data [ next-editor:address:editor-data in-focus?:boolean # set for the one editor in this chain currently being edited - # functions to run - render:recipe-ordinal # how to render this container + # recipes that each editor may hook to run at various points respond:recipe-ordinal # how it reacts to events from the console + # ingredients: screen, console, this editor-data, event ] # editor:address, screen:address <- new-editor s:address:array:character, screen:address, top:number, left:number, bottom:number @@ -142,8 +142,9 @@ recipe new-editor [ # if using multiple editors, must call reset-focus after chaining them all b:address:boolean <- get-address result:address:editor-data/deref, in-focus?:offset b:address:boolean/deref <- copy 1:literal/true -#? $print d:address:address:duplex-list/deref, [ -#? ] #? 1 + # initialize 'hook' recipes + r:address:recipe-ordinal <- get-address result:address:editor-data/deref, respond:offset + r:address:recipe-ordinal/deref <- copy handle-event:recipe # early exit if s is empty reply-unless s:address:array:character, result:address:editor-data len:number <- length s:address:array:character/deref @@ -493,7 +494,8 @@ recipe event-loop [ curr:address:editor-data <- copy editor:address:editor-data { break-unless curr:address:editor-data - handle-event screen:address, console:address, curr:address:editor-data, e:event + responder:recipe-ordinal <- get curr:address:editor-data/deref, respond:offset + call responder:recipe-ordinal, screen:address, console:address, curr:address:editor-data, e:event curr:address:editor-data <- get curr:address:editor-data/deref, next-editor:offset loop } |