rubrikinc / wachy

A UI for eBPF-based performance debugging
https://rubrikinc.github.io/wachy/
Other
551 stars 17 forks source link

Make search view provide more than 8 results (scrolling) #5

Closed fasterit closed 2 years ago

fasterit commented 2 years ago

There is some confusion using the SEARCH_VIEW_HEIGHT variable to limit amount of the search results. Clearing that up allows a much more useful search view:

diff --git a/src/views.rs b/src/views.rs
index 7298cbd..2c6ee05 100644
--- a/src/views.rs
+++ b/src/views.rs
@@ -215,6 +215,7 @@ pub type SearchView = ResizedView<Dialog>;

 const SEARCH_VIEW_WIDTH: usize = 70;
 const SEARCH_VIEW_HEIGHT: usize = 8;
+const SEARCH_VIEW_MAX_COUNT: usize = 50;

 /// `title` must be unique (it is used in the name of the view). Parameters of
 /// `edit_search_fn` are search view name, search string, and (max) number of
@@ -253,11 +254,11 @@ where
             .min_width(SEARCH_VIEW_WIDTH - 2), // ScrollView adds 2 character border
     )
     .scroll_x(true)
-    .fixed_size((SEARCH_VIEW_WIDTH, 8));
+    .fixed_size((SEARCH_VIEW_WIDTH, SEARCH_VIEW_HEIGHT));

     let update_edit_view = move |siv: &mut Cursive, search: &str, _| {
         // TODO we should add more results and allow scrolling?
-        edit_search_fn(siv, &name, search, SEARCH_VIEW_HEIGHT);
+        edit_search_fn(siv, &name, search, SEARCH_VIEW_MAX_COUNT);
     };
     let edit_view = EditView::new()
         .filler(" ")

Greetings! /DLange

viveksjain commented 2 years ago

Great! Also managed to figure out why the scrollbars weren't showing while I was at it.