Skip to content

Keyboard_widget InputCapture processing order issue when same key used with modifier #2027

Description

@cbRoy

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
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions