mirror of
				https://github.com/shokinn/hosts-go.git
				synced 2025-11-04 12:38:34 +00:00 
			
		
		
		
	Merge pull request #6 from shokinn/codex/update-key-bindings-as-per-project-brief
Align key bindings with project brief
This commit is contained in:
		
						commit
						63c0d38455
					
				
					 4 changed files with 9 additions and 8 deletions
				
			
		| 
						 | 
					@ -18,13 +18,13 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
 | 
				
			||||||
			} else {
 | 
								} else {
 | 
				
			||||||
				m.focus = listPane
 | 
									m.focus = listPane
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		case "e":
 | 
							case "ctrl+e":
 | 
				
			||||||
			if m.mode == ViewMode {
 | 
								if m.mode == ViewMode {
 | 
				
			||||||
				m.mode = EditMode
 | 
									m.mode = EditMode
 | 
				
			||||||
			} else {
 | 
								} else {
 | 
				
			||||||
				m.mode = ViewMode
 | 
									m.mode = ViewMode
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		case "a":
 | 
							case " ":
 | 
				
			||||||
			if m.mode == EditMode {
 | 
								if m.mode == EditMode {
 | 
				
			||||||
				if entry := m.SelectedEntry(); entry != nil {
 | 
									if entry := m.SelectedEntry(); entry != nil {
 | 
				
			||||||
					entry.Active = !entry.Active
 | 
										entry.Active = !entry.Active
 | 
				
			||||||
| 
						 | 
					@ -34,7 +34,7 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		case "up", "k":
 | 
							case "up", "k":
 | 
				
			||||||
			if m.focus == detailPane {
 | 
								if m.focus == detailPane {
 | 
				
			||||||
				m.detail.LineUp(1)
 | 
									m.detail.ScrollUp(1)
 | 
				
			||||||
			} else {
 | 
								} else {
 | 
				
			||||||
				m.list, cmd = m.list.Update(msg)
 | 
									m.list, cmd = m.list.Update(msg)
 | 
				
			||||||
				m.refreshDetail()
 | 
									m.refreshDetail()
 | 
				
			||||||
| 
						 | 
					@ -42,7 +42,7 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
 | 
				
			||||||
			return m, cmd
 | 
								return m, cmd
 | 
				
			||||||
		case "down", "j":
 | 
							case "down", "j":
 | 
				
			||||||
			if m.focus == detailPane {
 | 
								if m.focus == detailPane {
 | 
				
			||||||
				m.detail.LineDown(1)
 | 
									m.detail.ScrollDown(1)
 | 
				
			||||||
			} else {
 | 
								} else {
 | 
				
			||||||
				m.list, cmd = m.list.Update(msg)
 | 
									m.list, cmd = m.list.Update(msg)
 | 
				
			||||||
				m.refreshDetail()
 | 
									m.refreshDetail()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -24,8 +24,8 @@
 | 
				
			||||||
- ✅ **Parser integration** loading `/etc/hosts` into the UI
 | 
					- ✅ **Parser integration** loading `/etc/hosts` into the UI
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### Phase 3: Edit Mode (IN PROGRESS)
 | 
					### Phase 3: Edit Mode (IN PROGRESS)
 | 
				
			||||||
- 🔄 **Edit mode toggle** via 'e' key with status bar indication
 | 
					- 🔄 **Edit mode toggle** via 'ctrl+e' key with status bar indication
 | 
				
			||||||
- 🔄 **Entry activation toggle** using 'a' key
 | 
					- 🔄 **Entry activation toggle** using spacebar
 | 
				
			||||||
- 🔄 **Model tests** covering edit mode behavior
 | 
					- 🔄 **Model tests** covering edit mode behavior
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### Parser Capabilities Achieved
 | 
					### Parser Capabilities Achieved
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -80,6 +80,7 @@
 | 
				
			||||||
- **Active work**: Expand edit mode with file integration and advanced editing
 | 
					- **Active work**: Expand edit mode with file integration and advanced editing
 | 
				
			||||||
- **Blockers**: None - comprehensive parser foundation with 54 tests completed
 | 
					- **Blockers**: None - comprehensive parser foundation with 54 tests completed
 | 
				
			||||||
- **Parser status**: Production-ready with all safety features implemented
 | 
					- **Parser status**: Production-ready with all safety features implemented
 | 
				
			||||||
 | 
					- **Key bindings updated**: `ctrl+e` for edit mode, spacebar to toggle entries
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### Development Readiness
 | 
					### Development Readiness
 | 
				
			||||||
- ✅ **Architecture designed**: Clear technical approach documented
 | 
					- ✅ **Architecture designed**: Clear technical approach documented
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -72,12 +72,12 @@ func TestEditModeToggleAndActivation(t *testing.T) {
 | 
				
			||||||
	m := tui.NewModel(hf)
 | 
						m := tui.NewModel(hf)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// enter edit mode
 | 
						// enter edit mode
 | 
				
			||||||
	nm, _ := m.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{'e'}})
 | 
						nm, _ := m.Update(tea.KeyMsg{Type: tea.KeyCtrlE})
 | 
				
			||||||
	m = nm.(tui.Model)
 | 
						m = nm.(tui.Model)
 | 
				
			||||||
	assert.Equal(t, tui.EditMode, m.Mode())
 | 
						assert.Equal(t, tui.EditMode, m.Mode())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// toggle active state of first entry
 | 
						// toggle active state of first entry
 | 
				
			||||||
	nm, _ = m.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{'a'}})
 | 
						nm, _ = m.Update(tea.KeyMsg{Type: tea.KeySpace})
 | 
				
			||||||
	m = nm.(tui.Model)
 | 
						m = nm.(tui.Model)
 | 
				
			||||||
	assert.False(t, m.SelectedEntry().Active)
 | 
						assert.False(t, m.SelectedEntry().Active)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue