DoKeyEvent: document return value

The return value of DoKeyEvent() has a dual meaning, which makes the
code not obvious and confusing. So at least document it.
This commit is contained in:
Dmytro Maluka 2024-04-24 23:21:28 +02:00
parent 8c7f63ac15
commit 36bf3f6619
2 changed files with 8 additions and 2 deletions

View file

@ -540,7 +540,10 @@ func (h *BufPane) Bindings() *KeyTree {
}
// DoKeyEvent executes a key event by finding the action it is bound
// to and executing it (possibly multiple times for multiple cursors)
// to and executing it (possibly multiple times for multiple cursors).
// Returns true if the action was executed OR if there are more keys
// remaining to process before executing an action (if this is a key
// sequence event). Returns false if no action found.
func (h *BufPane) DoKeyEvent(e Event) bool {
binds := h.Bindings()
action, more := binds.NextEvent(e, nil)

View file

@ -124,7 +124,10 @@ func (h *InfoPane) HandleEvent(event tcell.Event) {
}
}
// DoKeyEvent executes a key event for the command bar, doing any overridden actions
// DoKeyEvent executes a key event for the command bar, doing any overridden actions.
// Returns true if the action was executed OR if there are more keys remaining
// to process before executing an action (if this is a key sequence event).
// Returns false if no action found.
func (h *InfoPane) DoKeyEvent(e KeyEvent) bool {
action, more := InfoBindings.NextEvent(e, nil)
if action != nil && !more {