Help on every panel, task filter, unblock key, mouse zones, safe add-only rebuild
This commit is contained in:
@@ -52,6 +52,7 @@ type repairModel struct {
|
||||
tab int
|
||||
scroll int
|
||||
|
||||
showHelp bool
|
||||
width, height int
|
||||
}
|
||||
|
||||
@@ -196,7 +197,14 @@ func (m repairModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
return m, tea.Batch(m.load(), tickEvery(8*time.Second))
|
||||
|
||||
case tea.KeyMsg:
|
||||
if m.showHelp {
|
||||
m.showHelp = false
|
||||
return m, nil
|
||||
}
|
||||
switch msg.String() {
|
||||
case "?":
|
||||
m.showHelp = true
|
||||
return m, nil
|
||||
case "q", "ctrl+c":
|
||||
return m, tea.Quit
|
||||
case "r":
|
||||
@@ -207,6 +215,17 @@ func (m repairModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
return m, nil
|
||||
}
|
||||
return m, tea.Quit
|
||||
case "B":
|
||||
// Add what is missing without replacing what is there. Safe to press
|
||||
// from inside a pane, because it never closes one.
|
||||
out, err := exec.Command(filepath.Join(exeDir(), "board"), "--folder", m.folder).CombinedOutput()
|
||||
if err != nil {
|
||||
m.err = fmt.Errorf("adding the missing panes failed: %v: %s", err, strings.TrimSpace(string(out)))
|
||||
return m, nil
|
||||
}
|
||||
m.err = nil
|
||||
m.tab = 1
|
||||
return m, m.load()
|
||||
case "[", "h":
|
||||
m.tab = (m.tab + len(repairTabs) - 1) % len(repairTabs)
|
||||
m.scroll = 0
|
||||
@@ -244,6 +263,18 @@ func (m repairModel) View() string {
|
||||
fmt.Sprintf("This workspace needs 80 × 24.\nThis panel is %d × %d.", m.width, m.height))
|
||||
}
|
||||
|
||||
if m.showHelp {
|
||||
return helpOverlay("repair", [][2]string{
|
||||
{"[ ] h l", "health, layout, rebuild log"},
|
||||
{"R", "rebuild every pane"},
|
||||
{"B", "add only the missing panes"},
|
||||
{"↑ ↓ j k", "scroll"},
|
||||
{"r", "check again"},
|
||||
{"q", "leave"},
|
||||
{"?", "this list"},
|
||||
}, m.width, m.height)
|
||||
}
|
||||
|
||||
head := titleStyle.Render("Repair") + mutedStyle2().Render(" · layout and health")
|
||||
state := "read " + m.readAt.Format("15:04:05")
|
||||
if m.readAt.IsZero() {
|
||||
|
||||
Reference in New Issue
Block a user