~rafael/gembro

cf85f981d75461e517d9182b1bc6f29a0391ec80 — RafaĆ«l L. Bekkema 3 years ago eb2deeb
Add tab and shift+tab shortcuts
1 files changed, 6 insertions(+), 0 deletions(-)

M main.go
M main.go => main.go +6 -0
@@ 255,6 255,12 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
		switch keys {
		case "ctrl+c":
			return m, fireEvent(QuitEvent{})
		case "tab":
			num := (m.currentTab + 1) % len(m.tabs)
			return m.selectTab(num)
		case "shift+tab":
			num := (m.currentTab + len(m.tabs) - 1) % len(m.tabs)
			return m.selectTab(num)
		}
		if msg.Alt && len(msg.Runes) == 1 && '1' <= msg.Runes[0] && msg.Runes[0] <= '9' {
			num := int(msg.Runes[0] - '0')