Patch from Dmytro Bagrii

Fix fbrun completion search for last directory in PATH
This commit is contained in:
Mark Tiefenbruck 2021-07-06 16:10:30 -07:00
parent dd238f9d95
commit ee9c0a34ba

View file

@ -508,8 +508,8 @@ void FbRun::tabCompleteApps() {
first_run = false; first_run = false;
std::string path = getenv("PATH"); std::string path = getenv("PATH");
FbTk::Directory dir; FbTk::Directory dir;
for (unsigned int l = 0, r = 0; r < path.size(); ++r) { for (unsigned int l = 0, r = 0; r <= path.size(); ++r) {
if ((path.at(r) == ':' || r == path.size() - 1) && r - l > 1) { if ((r == path.size() || path.at(r) == ':') && r - l > 1) {
dir.open(path.substr(l, r - l).c_str()); dir.open(path.substr(l, r - l).c_str());
prefix = dir.name() + (*dir.name().rbegin() == '/' ? "" : "/"); prefix = dir.name() + (*dir.name().rbegin() == '/' ? "" : "/");
int n = dir.entries(); int n = dir.entries();