io/key,io/pointer: forbid nil tags for InputOps

Forcing a non-nil tag ensures that all handler tags are either unique,
or intentionally equal. Additionally, a nil tag has special meaning in
FocusOps.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2021-01-22 16:38:25 +01:00
parent 4f45d9a567
commit 686d680ea3
2 changed files with 6 additions and 0 deletions
+3
View File
@@ -121,6 +121,9 @@ func (m Modifiers) Contain(m2 Modifiers) bool {
}
func (h InputOp) Add(o *op.Ops) {
if h.Tag == nil {
panic("Tag must be non-nil")
}
data := o.Write1(opconst.TypeKeyInputLen, h.Tag)
data[0] = byte(opconst.TypeKeyInput)
}