mirror of
				https://github.com/Maks1mS/bubbles.git
				synced 2025-10-31 13:51:23 +03:00 
			
		
		
		
	Shift+tab cycles backwards over fields
This commit is contained in:
		| @@ -47,10 +47,15 @@ func update(msg tea.Msg, model tea.Model) (tea.Model, tea.Cmd) { | |||||||
|  |  | ||||||
| 	case tea.KeyMsg: | 	case tea.KeyMsg: | ||||||
| 		switch msg.String() { | 		switch msg.String() { | ||||||
|  |  | ||||||
| 		case "ctrl+c": | 		case "ctrl+c": | ||||||
| 			return m, tea.Quit | 			return m, tea.Quit | ||||||
|  |  | ||||||
|  | 		// Cycle between inputs | ||||||
| 		case "tab": | 		case "tab": | ||||||
| 			fallthrough | 			fallthrough | ||||||
|  | 		case "esc": // note: shift+tab sends an escape | ||||||
|  | 			fallthrough | ||||||
| 		case "enter": | 		case "enter": | ||||||
| 			fallthrough | 			fallthrough | ||||||
| 		case "up": | 		case "up": | ||||||
| @@ -61,7 +66,7 @@ func update(msg tea.Msg, model tea.Model) (tea.Model, tea.Cmd) { | |||||||
| 				m.emailInput, | 				m.emailInput, | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			if msg.String() == "up" { | 			if msg.String() == "up" || msg.String() == "esc" { | ||||||
| 				m.index-- | 				m.index-- | ||||||
| 			} else { | 			} else { | ||||||
| 				m.index++ | 				m.index++ | ||||||
| @@ -85,6 +90,7 @@ func update(msg tea.Msg, model tea.Model) (tea.Model, tea.Cmd) { | |||||||
| 			m.emailInput = inputs[1] | 			m.emailInput = inputs[1] | ||||||
|  |  | ||||||
| 			return m, nil | 			return m, nil | ||||||
|  |  | ||||||
| 		default: | 		default: | ||||||
| 			m.nameInput, _ = input.Update(msg, m.nameInput) | 			m.nameInput, _ = input.Update(msg, m.nameInput) | ||||||
| 			m.emailInput, _ = input.Update(msg, m.emailInput) | 			m.emailInput, _ = input.Update(msg, m.emailInput) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user