Return precise number of matches from the completion code, and when
completing a file name, drop the slash if not unique.
Otherwise if there are several directory that end with the same string,
that can get a '/' added too early.
Signed-off-by: NeilBrown <neil@brown.name>
- [X] w3m hangs for CAAmjac0r78WpiYW9FsJK=+E8-FG4MoxD2zkUJS_oCRyNW+=rug@mail.gmail.com
It is writing to stdout which is reading very slowly.
-- [ ] in filename completion, TAB might add a '/' to a partial name and
+- [X] in filename completion, TAB might add a '/' to a partial name and
then get confused.
- [X] when search succeeds on final line then trying again loops back to
there, redraw is strange
return Efail;
cr = call_ret(all, "Complete:prefix", p, 1, NULL, b,
0, NULL, "format:plain");
+ if (cr.s && cr.ret-1 > 1 && cr.s[strlen(cr.s)-1] == '/')
+ /* Trailing slash on non-unique name must be removed */
+ cr.s[strlen(cr.s)-1] = '\0';
if (cr.s && (strlen(cr.s) <= strlen(b) && cr.ret-1 > 1)) {
/* We need the dropdown - delete prefix and drop-down will
* insert result.
cb->common = NULL;
free(cb->common_pre);
cb->common_pre = NULL;
+ cb->cnt = 0;
}
if (this_match == cb->best_match) {
cb->common_pre[match-c] = 0;
} else
adjust_pre(cb->common_pre, c, match-c);
+ cb->cnt += 1;
}
- cb->cnt += 1;
return 1;
}