aboutsummaryrefslogtreecommitdiff
path: root/sdn.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sdn.cpp')
-rw-r--r--sdn.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/sdn.cpp b/sdn.cpp
index ff5e804..b9aec88 100644
--- a/sdn.cpp
+++ b/sdn.cpp
@@ -989,17 +989,19 @@ fun show_help () {
fclose (contents);
}
-fun search (const wstring &needle) {
- int best = g.cursor, best_n = 0;
+fun search (const wstring &needle) -> int {
+ int best = g.cursor, best_n = 0, matches = 0;
for (int i = 0; i < int (g.entries.size ()); i++) {
auto o = (i + g.cursor) % g.entries.size ();
int n = prefix_length (to_wide (g.entries[o].filename), needle);
+ matches += n == needle.size ();
if (n > best_n) {
best = o;
best_n = n;
}
}
g.cursor = best;
+ return matches;
}
fun fix_cursor_and_offset () {