File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed
Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change 77 */
88
99public class FileItem : Gtk .ListBoxRow {
10- public SearchResult result { get ; private set ; }
10+ public SearchResult result { get ; private set ; }
1111
1212 public string filepath {
1313 get {
1414 return result. full_path;
1515 }
1616 }
17+
1718 public FileItem (SearchResult res , bool should_distinguish_project = false ) {
1819 this . get_style_context (). add_class (" fuzzy-item" );
1920 this . get_style_context (). add_class (" flat" );
Original file line number Diff line number Diff line change @@ -266,13 +266,19 @@ public class Scratch.FuzzySearchPopover : Gtk.Popover {
266266 scrolled. set_max_content_height (45 /* height */ * max_items);
267267
268268 current_doc_project = get_current_project (); // This will not change while popover is showing
269- search_result_container. set_sort_func ((a ,b) = > {
270- var project_a_is_current = ((FileItem )a). result. project == current_doc_project;
271- var project_b_is_current = ((FileItem )b). result. project == current_doc_project;
269+ search_result_container. set_sort_func ((a , b) = > {
270+ var result_a = ((FileItem )a). result;
271+ var result_b = ((FileItem )b). result;
272+ var project_a_is_current = result_a. project == current_doc_project;
273+ var project_b_is_current = result_b. project == current_doc_project;
272274 if (project_a_is_current && ! project_b_is_current) {
273275 return 1 ;
274276 } else if (project_b_is_current && ! project_a_is_current) {
275277 return - 1 ;
278+ } else if (result_a. score > result_b. score) {
279+ return - 1 ;
280+ } else if (result_b. score > result_a. score) {
281+ return 1 ;
276282 } else {
277283 return strcmp (((FileItem )a). result. full_path, ((FileItem )b). result. full_path);
278284 }
You can’t perform that action at this time.
0 commit comments