-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathevent-queue.txt
143 lines (105 loc) · 3.81 KB
/
event-queue.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# Event Queue
heterogeneous - keys, macros, mouse, OP_X
abstract: queue of [timestamp, type, data] -> API
owned by NeoMutt?
Actions: keypress, mouse move, code push (command)
are keypresses independent of processing?
who interprets?
when?
-> check_for_keys() -> queue_key()
process_queue() -> get_event()
how's it fit into external event loop?
how are events interpreted?
need 'd' -> OP_DELETE lookup
need "<F1>" (macro) -> "Twork<enter>;d"
need ":push 'text'" -> *insert* into queue
single keypress is easy to interpret
is macro 'n' keypresses? or atomic text string?
atomic ->
1) bind a, 2) bind b, 3) bind ab + macro "ab" triggers 3)
dialog wants event; queue has plenty
dialog needs to specify *all* of its function handlers!
each function handler is associated with a Window
Global event handler offers each Window a "go" + recursion
-> Reply: Yes, No, Longer
Yes: might imply a macro has inserted more events to the head
=> each Window needs to be able to handle any type of Event
can global handler deal with macros? probably
bind ab, macro ax
offer 'a' -> longer
offer 'ax' -> fail
then what?
who errors 'a' unknown?
do we try 'x' again? probably
---
macros *must* be interpreted letter by letter - nested macros or other bindings
problem: macro "abc" where 'a' expands to "xyz"
need to insert "xyz" while global handler is working on "abc"
macro "aaaaaXbbbbb" (X expands)
need 1 char (char could be multibyte utf-8)
queue doesn't understand data
macro object could keep track
caller could peek at queue (ok for a single thread)
caller: t = q_top(); get_char(t)
what if it returns OP_X?
if t is empty, pop and retry
caller gets X, expands to macro "RST" (could be multiple items)
could be multiple substitutions
"aaaaaXbbbbb" isn't finished
caller: q_insert_head("RST")
next get/peek gets "RST"
macro calls: "push '...'" (global)
macro more events from ":source script.sh|"
callers from different Windows / levels
who's driving?
If in AliasDlg -> MsgWin (:command) does <next-entry> work?
currently no, but with global event handler, yes
could we stop it happening? Alias could check focus
do we want to stop it happening?
it could change the select
what if the <exit> the dialog?! -- let them?
might not be possible if MsgWin handles <exit>
---
macro calls: push "RST" Q: "aaaaaXbbbbb2"; other
macro object points to first 'b' Q: "RST"; "aaaaaXbbbbb2"; other
parse_rc_line()
radical idea... are `:command`s part of the event queue?
config/hook: echo apple; push "<banana>"; echo cherry
the entire string is queued as a single item...
the "processor" gets the top of the queue, parses "echo apple;" and executes it
the queue is left with: push "<banana>"; echo cherry
the "processor" gets the top of the queue, parses: push "<banana>"
"push" causes the text to be inserted
queue: "<banana>"; "echo cherry"
parse and execute <banana>
parse and execute "echo cherry"
what about
sync-`echo mailbox`
shell command must be synchronous
echo apple
push "<enter-command>echo banana<enter>"
echo cherry
---
parse_rc_line()
"sync-`echo mailbox`"
echo apple; push "<banana>"; echo cherry
echo apple; source banana.sh|; echo cherry
banana -> "echo x; push y; echo z"
normally x| output is read and processed from the pipe
save to file and queue the file?
need file?
it could be big
does the normal config read use the same mechanism?
source a.rc -> source b.rc, c.rc -> x.rc, y.rc
a.rc
├── b.rc
└── c.rc
├── x.rc
└── y.rc
Q object: filename, current line
what's the diff between startup config and :source?
latter can <push>
what does push do at startup?
who is interpreting <xyz> and when?
needs to be put into Q and parsed when it's read
which Q items interpret <X>, which are literal?