ui: move ops reader to ui package

To prepare support for cached OpBlock to refer to other Ops lists.

The exposure of OpsReader is alleviated by the removal of the Refs
and Data accessors for Ops.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2019-06-01 19:46:46 +02:00
parent 528a588f2e
commit 5966aab77e
6 changed files with 90 additions and 102 deletions
+3 -3
View File
@@ -11,7 +11,7 @@ type Queue struct {
focus Key
events []Event
handlers map[Key]bool
reader ops.Reader
reader ui.OpsReader
}
type listenerPriority uint8
@@ -25,7 +25,7 @@ const (
func (q *Queue) Frame(root *ui.Ops) TextInputState {
q.events = q.events[:0]
q.reader.Reset(root.Data(), root.Refs())
q.reader.Reset(root)
f, pri, hide := resolveFocus(&q.reader, q.focus)
changed := f != nil && f != q.focus
for k, active := range q.handlers {
@@ -74,7 +74,7 @@ func (q *Queue) For(k Key) []Event {
return q.events
}
func resolveFocus(r *ops.Reader, focus Key) (Key, listenerPriority, bool) {
func resolveFocus(r *ui.OpsReader, focus Key) (Key, listenerPriority, bool) {
var k Key
var pri listenerPriority
var hide bool