mirror of
https://github.com/shokinn/hosts-go.git
synced 2025-08-23 00:23:02 +00:00
Update key bindings to match project brief
This commit is contained in:
parent
9af4c54d1e
commit
ecb7a1ab93
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 {
|
||||
m.focus = listPane
|
||||
}
|
||||
case "e":
|
||||
case "ctrl+e":
|
||||
if m.mode == ViewMode {
|
||||
m.mode = EditMode
|
||||
} else {
|
||||
m.mode = ViewMode
|
||||
}
|
||||
case "a":
|
||||
case " ":
|
||||
if m.mode == EditMode {
|
||||
if entry := m.SelectedEntry(); entry != nil {
|
||||
entry.Active = !entry.Active
|
||||
|
@ -34,7 +34,7 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
|||
}
|
||||
case "up", "k":
|
||||
if m.focus == detailPane {
|
||||
m.detail.LineUp(1)
|
||||
m.detail.ScrollUp(1)
|
||||
} else {
|
||||
m.list, cmd = m.list.Update(msg)
|
||||
m.refreshDetail()
|
||||
|
@ -42,7 +42,7 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
|||
return m, cmd
|
||||
case "down", "j":
|
||||
if m.focus == detailPane {
|
||||
m.detail.LineDown(1)
|
||||
m.detail.ScrollDown(1)
|
||||
} else {
|
||||
m.list, cmd = m.list.Update(msg)
|
||||
m.refreshDetail()
|
||||
|
|
|
@ -24,8 +24,8 @@
|
|||
- ✅ **Parser integration** loading `/etc/hosts` into the UI
|
||||
|
||||
### Phase 3: Edit Mode (IN PROGRESS)
|
||||
- 🔄 **Edit mode toggle** via 'e' key with status bar indication
|
||||
- 🔄 **Entry activation toggle** using 'a' key
|
||||
- 🔄 **Edit mode toggle** via 'ctrl+e' key with status bar indication
|
||||
- 🔄 **Entry activation toggle** using spacebar
|
||||
- 🔄 **Model tests** covering edit mode behavior
|
||||
|
||||
### Parser Capabilities Achieved
|
||||
|
|
|
@ -80,6 +80,7 @@
|
|||
- **Active work**: Expand edit mode with file integration and advanced editing
|
||||
- **Blockers**: None - comprehensive parser foundation with 54 tests completed
|
||||
- **Parser status**: Production-ready with all safety features implemented
|
||||
- **Key bindings updated**: `ctrl+e` for edit mode, spacebar to toggle entries
|
||||
|
||||
### Development Readiness
|
||||
- ✅ **Architecture designed**: Clear technical approach documented
|
||||
|
|
|
@ -72,12 +72,12 @@ func TestEditModeToggleAndActivation(t *testing.T) {
|
|||
m := tui.NewModel(hf)
|
||||
|
||||
// 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)
|
||||
assert.Equal(t, tui.EditMode, m.Mode())
|
||||
|
||||
// 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)
|
||||
assert.False(t, m.SelectedEntry().Active)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue