diff options
author | Phil Jones <philj56@gmail.com> | 2023-07-16 11:43:26 +0100 |
---|---|---|
committer | Phil Jones <philj56@gmail.com> | 2023-07-16 11:43:26 +0100 |
commit | 548de1f8c63d4a088400e724a37d483656a2c645 (patch) | |
tree | b391f0b3567769baaefb5966ef6f8552f2b841f8 /src | |
parent | 6060daaee163918f97af4db09bba9a7f9272d6c1 (diff) |
Fix --print-index when searching.
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -1040,7 +1040,12 @@ static bool do_submit(struct tofi *tofi) } } else { if (entry->mode == TOFI_MODE_PLAIN && tofi->print_index) { - printf("%u\n", selection + 1); + for (size_t i = 0; i < entry->commands.count; i++) { + if (res == entry->commands.buf[i].string) { + printf("%u\n", i + 1); + break; + } + } } else { printf("%s\n", res); } |