mirror of
https://github.com/l0ng-ai/tty7.git
synced 2026-09-22 08:02:24 +00:00
fix(sidebar): search what the row shows, not just the part that fits
Each sidebar row shows a truncated title and a branch. The filter read only the truncated title, so typing the branch you can see — or the part of the path the row elided — matched nothing, and the list emptied out on a query that is plainly on screen. It now matches the full title and the branch as well as the label.
This commit is contained in:
+15
-1
@@ -79,7 +79,21 @@ impl Tty7App {
|
||||
s.tabs
|
||||
.iter()
|
||||
.map(|&i| (i, self.tab_label(&self.tabs[i], i, Some(window), cx)))
|
||||
.filter(|(_, label)| query.is_empty() || label.to_lowercase().contains(&query))
|
||||
// The row shows a truncated title and a branch; the filter
|
||||
// only ever read the truncated title, so typing the branch
|
||||
// you can see, or the part of the path the row elided,
|
||||
// matched nothing.
|
||||
.filter(|(i, label)| {
|
||||
query.is_empty()
|
||||
|| label.to_lowercase().contains(&query)
|
||||
|| self.tabs[*i]
|
||||
.leaf_title(Some(window), cx)
|
||||
.to_lowercase()
|
||||
.contains(&query)
|
||||
|| self.tabs[*i]
|
||||
.git_status(Some(window), cx)
|
||||
.is_some_and(|g| g.branch.to_lowercase().contains(&query))
|
||||
})
|
||||
.collect()
|
||||
})
|
||||
.collect();
|
||||
|
||||
Reference in New Issue
Block a user