#2027·wtf

Keyboard_widget InputCapture processing order issue when same key used with modifier

Author: cbRoyCreated Mar 6, 2026Updated Mar 12, 2026

https://github.com/wtfutil/wtf/blame/2a48425a6997eaa9943456010f408b0da37ec6d5/view/keyboard_widget.go#L99

Event key needs to be captured and processed before regular key press, otherwise original key press action is performed.

Noticed in ToDo module, could not demote, promote, or set item to first because keys "jk, and f" have their own actions and CTRL functions were being ignored

solution: process keyMap before charMap

func (widget *KeyboardWidget) InputCapture(event *tcell.EventKey) *tcell.EventKey {
	if event == nil {
		return nil
	}

	fn := widget.keyMap[event.Key()]
	if fn != nil {
		fn()
		return nil
	}

	fn = widget.charMap[string(event.Rune())]
	if fn != nil {
		fn()
		return nil
	}

	return event
}