Skip to content

Commit 36bf3f6

Browse files
committed
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.
1 parent 8c7f63a commit 36bf3f6

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

internal/action/bufpane.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,10 @@ func (h *BufPane) Bindings() *KeyTree {
540540
}
541541

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

internal/action/infopane.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,10 @@ func (h *InfoPane) HandleEvent(event tcell.Event) {
124124
}
125125
}
126126

127-
// DoKeyEvent executes a key event for the command bar, doing any overridden actions
127+
// DoKeyEvent executes a key event for the command bar, doing any overridden actions.
128+
// Returns true if the action was executed OR if there are more keys remaining
129+
// to process before executing an action (if this is a key sequence event).
130+
// Returns false if no action found.
128131
func (h *InfoPane) DoKeyEvent(e KeyEvent) bool {
129132
action, more := InfoBindings.NextEvent(e, nil)
130133
if action != nil && !more {

0 commit comments

Comments
 (0)