io/input: improve documentation, code

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2024-06-20 13:23:36 +02:00
parent 5542aac772
commit 706940ff9b
+5 -5
View File
@@ -313,15 +313,15 @@ func (q *Router) collapseState(idx int) {
} }
first := &q.changes[0] first := &q.changes[0]
first.state = q.changes[idx].state first.state = q.changes[idx].state
for i := 1; i <= idx; i++ { for _, ch := range q.changes[1 : idx+1] {
first.events = append(first.events, q.changes[i].events...) first.events = append(first.events, ch.events...)
} }
q.changes = append(q.changes[:1], q.changes[idx+1:]...) q.changes = append(q.changes[:1], q.changes[idx+1:]...)
} }
// Frame replaces the declared handlers from the supplied // Frame completes the current frame and starts a new with the
// operation list. The text input state, wakeup time and whether // handlers from the frame argument. Remaining events are discarded,
// there are active profile handlers is also saved. // unless they were deferred by a command.
func (q *Router) Frame(frame *op.Ops) { func (q *Router) Frame(frame *op.Ops) {
var remaining []event.Event var remaining []event.Event
if n := len(q.changes); n > 0 { if n := len(q.changes); n > 0 {