The editor mostly stays in a KeyGet()/PutKey() loop.    The putkey portion is where keys are acted-upon.    ZealOS has a chain 
of putkey handlers in a Circular Queue with priorities.  The highest priority handlers can choose to terminate handling, 
otherwise, the keys get sent on down the chain.

KeyDevAdd() defines a putkey device with a priority.    "Device" might be a misnomer.  Currently, the following are defined:

Priority        Handler
---------- ---------
0x20000000 MyPutKey() user handler
0x40000000 KDInputFilterPutKey() for In(), InStr(), and InFile() handling.
0x60000000 KDRawPutKey() nonwindowed direct to video mem debug output.
0x80000000 KDDocPutKey() standard document cmds

Since handling individual keys is slow, ZealOS supports PutS() as well.  If no puts handler is defined, individual keys are 
sent.

CDoc.user_put_key and CDoc.user_put_s are call back routines which offer some neat tricks.  See ::/Apps/Psalmody/JukeBox.ZC.  
There is a variable CDoc.user_put_data which gets passed to them.