diff options
Diffstat (limited to 'gui/internal')
| -rw-r--r-- | gui/internal/ui/forms.go | 26 | ||||
| -rw-r--r-- | gui/internal/ui/plan.go | 4 |
2 files changed, 20 insertions, 10 deletions
diff --git a/gui/internal/ui/forms.go b/gui/internal/ui/forms.go index 18a8b13..fd97546 100644 --- a/gui/internal/ui/forms.go +++ b/gui/internal/ui/forms.go @@ -386,7 +386,7 @@ func (r *settingRow) set(args string) { // formLabel is one line of the list: what the form is, and what it does. func formLabel(f model.Form) string { - if f.Kind == model.ExcludeForm { + if f.Kind == model.ExcludeForm || f.Rule == nil { return "exclude: " + f.Label } var what []string @@ -677,7 +677,7 @@ func newFormEditor(form model.Form, changed func()) *formEditor { fe.root.SetMarginTop(6) fe.root.SetMarginBottom(6) - if form.Kind == model.RuleForm { + if form.Kind == model.RuleForm && form.Rule != nil { fe.name = gtk.NewEntry() fe.name.SetText(form.Rule.Name) fe.name.SetHExpand(true) @@ -692,18 +692,25 @@ func newFormEditor(form model.Form, changed func()) *formEditor { fe.conditions = append(fe.conditions, &model.Cond{Kind: kind}) }))) - when := form.Rule.When - if form.Kind == model.ExcludeForm { - when = form.Exclude.When - } else if !form.Rule.HasWhen { - when = nil + // An exclude has no rule behind it and a rule may have no (when ...) at + // all, so neither pointer is followed without asking first: reading + // form.Rule for an exclude crashed the window (found by the release + // checklist, 2026-09-17). + var when []*sexp.Node + switch { + case form.Kind == model.ExcludeForm: + if form.Exclude != nil { + when = form.Exclude.When + } + case form.Rule != nil && form.Rule.HasWhen: + when = form.Rule.When } for _, c := range when { fe.conditions = append(fe.conditions, model.ParseCond(c)) } fe.drawConds() - if form.Kind == model.RuleForm { + if form.Kind == model.RuleForm && form.Rule != nil { fe.acts = gtk.NewBox(gtk.OrientationVertical, 4) fe.root.Append(heading("Actions - in order")) fe.root.Append(fe.acts) @@ -756,6 +763,9 @@ func (fe *formEditor) text() (string, error) { } return config.PrintExclude(&config.Exclude{When: when}), nil } + if fe.name == nil || fe.stop == nil { + return "", fmt.Errorf("this form has no rule behind it") + } rule := &config.Rule{ Name: fe.name.Text(), HasWhen: len(when) > 0, diff --git a/gui/internal/ui/plan.go b/gui/internal/ui/plan.go index 0adc6b1..5daba6a 100644 --- a/gui/internal/ui/plan.go +++ b/gui/internal/ui/plan.go @@ -672,7 +672,7 @@ func (p *planView) fillList() { // shown whole rather than cut to an ellipsis. The list scrolls sideways // when the total does not fit (his report, 2026-09-16). func (p *planView) widths() [7]int { - w := [7]int{16, 4, 3, 6, 16, 8, 6} + w := [7]int{16, 5, 4, 6, 16, 8, 6} root := p.dirRoot() now := time.Now() for _, r := range p.tab.Rows { @@ -761,7 +761,7 @@ func (p *planView) showOutcome() bool { // headerFloors are how narrow each heading may become, matching the cells // under it. -var headerFloors = [7]int{12, 4, 3, 6, 16, 10, 8} +var headerFloors = [7]int{12, 5, 4, 6, 16, 10, 8} // columnTitles name the columns of the plan. var columnTitles = [7]string{"file", "size", "age", "action", "where it would go", "rule", "outcome"} |
