From cff85b9a55c7d3f08de9ef9272b97d7fa6212302 Mon Sep 17 00:00:00 2001 From: Phil Jones Date: Tue, 5 Jul 2022 11:03:58 +0100 Subject: Sort results by match position. Search results will now be sorted by history first, then by the position of the match, such that a match at the start of a result will appear before a match later in the result. --- src/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index 307be0e..96140f5 100644 --- a/src/main.c +++ b/src/main.c @@ -1187,11 +1187,11 @@ int main(int argc, char *argv[]) tofi.submit = false; if (tofi.window.entry.results.count > 0) { uint32_t selection = tofi.window.entry.selection; - printf("%s\n", tofi.window.entry.results.buf[selection]); + printf("%s\n", tofi.window.entry.results.buf[selection].string); if (tofi.use_history) { history_add( &tofi.window.entry.history, - tofi.window.entry.results.buf[selection]); + tofi.window.entry.results.buf[selection].string); history_save(&tofi.window.entry.history); } break; -- cgit v1.2.3