mirror of
https://github.com/shokinn/hosts-go.git
synced 2025-08-23 08:33:02 +00:00
Add edit mode toggle and entry activation
This commit is contained in:
parent
0c60248d75
commit
51966f766c
6 changed files with 69 additions and 17 deletions
|
@ -18,6 +18,20 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
|||
} else {
|
||||
m.focus = listPane
|
||||
}
|
||||
case "e":
|
||||
if m.mode == ViewMode {
|
||||
m.mode = EditMode
|
||||
} else {
|
||||
m.mode = ViewMode
|
||||
}
|
||||
case "a":
|
||||
if m.mode == EditMode {
|
||||
if entry := m.SelectedEntry(); entry != nil {
|
||||
entry.Active = !entry.Active
|
||||
m.list.SetItem(m.list.Index(), entryItem{entry})
|
||||
m.refreshDetail()
|
||||
}
|
||||
}
|
||||
case "up", "k":
|
||||
if m.focus == detailPane {
|
||||
m.detail.LineUp(1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue