chiark
/
gitweb
/
~mdw
/
disorder
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Auto-collapse rows that were only expanded to display search results.
[disorder]
/
disobedience
/
choose-search.c
diff --git
a/disobedience/choose-search.c
b/disobedience/choose-search.c
index 96003e3b2f001272b12833a7446226c10f0f9fde..82a06757184aaa99db051b432ab16ce5a48c24e4 100644
(file)
--- a/
disobedience/choose-search.c
+++ b/
disobedience/choose-search.c
@@
-22,11
+22,12
@@
*
* TODO:
* - cleverer focus to implement typeahead find
*
* TODO:
* - cleverer focus to implement typeahead find
- * - don't steal ^A
*/
#include "disobedience.h"
#include "choose.h"
*/
#include "disobedience.h"
#include "choose.h"
+int choose_auto_expanding;
+
static GtkWidget *choose_search_entry;
static GtkWidget *choose_next;
static GtkWidget *choose_prev;
static GtkWidget *choose_search_entry;
static GtkWidget *choose_next;
static GtkWidget *choose_prev;
@@
-147,14
+148,16
@@
static int choose_make_one_visible(const char *track) {
} else {
//fprintf(stderr, " requesting expansion of %s\n", dir);
/* Track is below a non-expanded directory. So let's expand it.
} else {
//fprintf(stderr, " requesting expansion of %s\n", dir);
/* Track is below a non-expanded directory. So let's expand it.
- * choose_make_visible() will arrange a revisit in due course. */
+ * choose_make_visible() will arrange a revisit in due course.
+ *
+ * We mark the row as auto-expanded.
+ */
+ ++choose_auto_expanding;
gtk_tree_view_expand_row(GTK_TREE_VIEW(choose_view),
path,
FALSE/*open_all*/);
gtk_tree_path_free(path);
gtk_tree_view_expand_row(GTK_TREE_VIEW(choose_view),
path,
FALSE/*open_all*/);
gtk_tree_path_free(path);
- /* TODO: the old version would remember which rows had been expanded
- * just to show search results and collapse them again. We should
- * probably do that. */
+ --choose_auto_expanding;
return 0;
}
} else
return 0;
}
} else
@@
-279,6
+282,9
@@
static void choose_search_completed(void attribute((unused)) *v,
return;
}
//fprintf(stderr, "*** %d search results\n", nvec);
return;
}
//fprintf(stderr, "*** %d search results\n", nvec);
+ /* We're actually going to use these search results. Autocollapse anything
+ * left over from the old search. */
+ choose_auto_collapse();
choose_search_hash = hash_new(1);
if(nvec) {
for(int n = 0; n < nvec; ++n)
choose_search_hash = hash_new(1);
if(nvec) {
for(int n = 0; n < nvec; ++n)