Improves helder

This commit is contained in:
2026-10-05 09:24:25 +02:00
parent 8fafea4fc3
commit 336987d821
44 changed files with 3454 additions and 542 deletions
@@ -173,7 +173,6 @@ struct SearchOverlay: View {
ForEach(group.rows) { row in
let selected = model.column == .project && model.projectSelection == row.index
hitLine(row.hit, selected: selected)
.id(row.index)
.onHover { inside in if inside { hover(.project, row: row.index) } }
.onTapGesture { open(SearchModel.Target(path: row.path, line: row.hit.line)) }
}
@@ -181,7 +180,10 @@ struct SearchOverlay: View {
}
.padding(.bottom, 12)
}
.onChange(of: model.projectSelection) { _, row in proxy.scrollTo(row) }
// Scrolls by the ForEach id: an extra `.id` on a row makes the LazyVStack keep stale rows.
.onChange(of: model.projectSelection) { _, row in
if model.hitRows.indices.contains(row) { proxy.scrollTo(model.hitRows[row].id) }
}
}
}
}
@@ -238,13 +240,14 @@ struct SearchOverlay: View {
ForEach(Array(matches.enumerated()), id: \.element.path) { index, match in
let selected = model.column == .files && model.fileSelection == index
fileRow(match, selected: selected)
.id(index)
.onHover { inside in if inside { hover(.files, row: index) } }
.onTapGesture { open(SearchModel.Target(path: match.path, line: nil)) }
}
}
}
.onChange(of: model.fileSelection) { _, row in proxy.scrollTo(row) }
.onChange(of: model.fileSelection) { _, row in
if matches.indices.contains(row) { proxy.scrollTo(matches[row].path) }
}
}
}
}