aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-09-16 23:25:26 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-09-16 23:25:26 +0200
commit168fae0f72c3ca5ff9b307a42fb75173e58b5b17 (patch)
tree4596a1376387df126428c74041dc2acfbbee4a02
parent22c324d8e887a2c38d9ef01574e4c3f87f6b1706 (diff)
downloadkrino-168fae0f72c3ca5ff9b307a42fb75173e58b5b17.tar.gz
krino-168fae0f72c3ca5ff9b307a42fb75173e58b5b17.zip
gui: show the problems under both sub-tabs; name the operator rows; fix the list labels after an edit
-rw-r--r--gui/internal/ui/forms.go28
-rw-r--r--gui/internal/ui/rules.go7
2 files changed, 31 insertions, 4 deletions
diff --git a/gui/internal/ui/forms.go b/gui/internal/ui/forms.go
index 1606903..ecde546 100644
--- a/gui/internal/ui/forms.go
+++ b/gui/internal/ui/forms.go
@@ -22,6 +22,28 @@ import (
var condKinds = []string{"type", "name", "path", "content", "size", "age",
"duplicate", "matched", "and", "or", "not"}
+// condLabels is how the picker names them. The rows are already joined by
+// "all of these must hold", so the three operators say what they are for -
+// grouping conditions inside one row - rather than looking like the way to
+// join two rows (his report, 2026-09-16).
+var condLabels = map[string]string{
+ "and": "and (all of these)",
+ "or": "or (any of these)",
+ "not": "not (none of these)",
+}
+
+// condItems is condKinds as the picker shows them.
+func condItems() []string {
+ out := make([]string, len(condKinds))
+ for i, k := range condKinds {
+ out[i] = k
+ if label, ok := condLabels[k]; ok {
+ out[i] = label
+ }
+ }
+ return out
+}
+
// condHints is the example shown beside a row, by kind.
var condHints = map[string]string{
"type": `pdf doc (extensions or a group)`,
@@ -449,7 +471,9 @@ func (f *formsView) refreshLabels() {
}
f.forms = forms
for i, form := range forms {
- if row := f.list.RowAtIndex(i); row != nil {
+ // Row 0 is the directory itself, so form i is row i+1: without the
+ // offset every label moved up a row after an edit (his report).
+ if row := f.list.RowAtIndex(i + 1); row != nil {
if label, ok := row.Child().(*gtk.Label); ok {
label.SetText(escape(formLabel(form)))
}
@@ -687,7 +711,7 @@ type condRow struct {
func newCondRow(n *sexp.Node, changed func()) *condRow {
c := &condRow{}
c.root = gtk.NewBox(gtk.OrientationHorizontal, 6)
- c.kind = gtk.NewDropDownFromStrings(condKinds)
+ c.kind = gtk.NewDropDownFromStrings(condItems())
c.args = gtk.NewEntry()
c.args.SetHExpand(true)
if n != nil {
diff --git a/gui/internal/ui/rules.go b/gui/internal/ui/rules.go
index d582f1e..939d77f 100644
--- a/gui/internal/ui/rules.go
+++ b/gui/internal/ui/rules.go
@@ -101,8 +101,6 @@ func newRulesView(w *Window) *rulesView {
left := gtk.NewBox(gtk.OrientationVertical, 0)
left.Append(editScroll)
- left.Append(gtk.NewSeparator(gtk.OrientationHorizontal))
- left.Append(diagScroll)
// Test on file: any file under the directory, answered from the text in
// the editor rather than from what is saved.
@@ -152,6 +150,10 @@ func newRulesView(w *Window) *rulesView {
r.root.Append(bar)
r.root.Append(gtk.NewSeparator(gtk.OrientationHorizontal))
r.root.Append(panes)
+ // The problems sit under both sub-tabs: a form's mistake is reported
+ // where the form is, not only in the text (his report, 2026-09-16).
+ r.root.Append(gtk.NewSeparator(gtk.OrientationHorizontal))
+ r.root.Append(diagScroll)
// Switching to Forms re-reads the text; text that does not parse keeps
// the Text tab until it is fixed (GUI design ยง5.2).
@@ -336,6 +338,7 @@ func (r *rulesView) goToLine(name string) {
if err != nil || line <= 0 {
return
}
+ r.showText()
iter, ok := r.buf.IterAtLine(line - 1)
if !ok {
return