op: change signature of Ops.Write

By returning the allocated data buffer, Ops can become an interface
in a future change without forcing operations to allocate.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2019-10-14 23:10:35 +02:00
parent 88208891de
commit fa00b53e13
6 changed files with 24 additions and 34 deletions
+2 -4
View File
@@ -89,18 +89,16 @@ func (m Modifiers) Contain(m2 Modifiers) bool {
}
func (h InputOp) Add(o *op.Ops) {
data := make([]byte, opconst.TypeKeyInputLen)
data := o.Write(opconst.TypeKeyInputLen, h.Key)
data[0] = byte(opconst.TypeKeyInput)
if h.Focus {
data[1] = 1
}
o.Write(data, h.Key)
}
func (h HideInputOp) Add(o *op.Ops) {
data := make([]byte, opconst.TypeHideInputLen)
data := o.Write(opconst.TypeHideInputLen)
data[0] = byte(opconst.TypeHideInput)
o.Write(data)
}
func (EditEvent) ImplementsEvent() {}