display number of selected items as well, run subshell in the background

This commit is contained in:
speedie 2023-05-16 21:16:51 +02:00
parent ea3e7ed458
commit 2a9ae1480c
2 changed files with 15 additions and 3 deletions

View file

@ -608,7 +608,7 @@ exec_program() {
# finally run the program
if [ -n "$exec" ]; then
/bin/sh -c "$exec"
${SHELL:-/bin/sh} -c "$exec" &
else
printf "No executable found. Try clearing cache." >> "$LOGFILE"
fi

View file

@ -313,7 +313,7 @@ void appenditem(struct item *item, struct item **list, struct item **last) {
}
void recalculatenumbers(void) {
unsigned int numer = 0, denom = 0;
unsigned int numer = 0, denom = 0, selected = 0;
struct item *item;
if (matchend) {
numer++;
@ -327,8 +327,20 @@ void recalculatenumbers(void) {
for (item = items; item && item->text; item++)
denom++;
for (int i = 0; i < sel_size; i++) {
if (sel_index[i] == -1) {
break;
}
selected++;
}
if (selected) {
snprintf(numbers, NUMBERSBUFSIZE, "%d/%d/%d", numer, denom, selected);
} else {
snprintf(numbers, NUMBERSBUFSIZE, "%d/%d", numer, denom);
}
}
void calcoffsets(void) {
int i, n;