rivo / tview

Terminal UI library with rich, interactive widgets — written in Golang
MIT License
11.17k stars 574 forks source link

wiki: Using Different Keys --> Adding Key Aliases #851

Closed abitrolly closed 1 year ago

abitrolly commented 1 year ago

In Using Different Keys I would change the title to clarify that the chapter speaks about reusing key handler for a different key.

### Key Aliases

You can add another shortcut to function that is already mapped to specific key. For example,
if you want to `w` to behave like `j` - navigate upwards.

    textView.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey {
        if event.Rune() == 'w' {
            return tcell.NewEventKey(tcell.KeyRune, 'j', tcell.ModNone)
        }
        return event
    })
rivo commented 1 year ago

Thanks. I've added some clarifications to the wiki (as well as some new information which was still missing).