Exemple #1
0
func wrapRememberSequence(a Action) Action {
	return ActionFunc(func(i *Input, ev termbox.Event) {
		s, err := keyseq.EventToString(ev)
		if err == nil {
			i.currentKeySeq = append(i.currentKeySeq, s)
			i.SendStatusMsg(strings.Join(i.currentKeySeq, " "))
		}
		a.Execute(i, ev)
	})
}
Exemple #2
0
func wrapClearSequence(a Action) Action {
	return ActionFunc(func(i *Input, ev termbox.Event) {
		s, err := keyseq.EventToString(ev)
		if err == nil {
			i.currentKeySeq = append(i.currentKeySeq, s)
		}

		if len(i.currentKeySeq) > 0 {
			i.SendStatusMsgAndClear(strings.Join(i.currentKeySeq, " "), 500*time.Millisecond)
			i.currentKeySeq = []string{}
		}

		a.Execute(i, ev)
	})
}