aboutsummaryrefslogtreecommitdiff
path: root/util/fbrun/FbRun.cc
diff options
context:
space:
mode:
Diffstat (limited to 'util/fbrun/FbRun.cc')
-rw-r--r--util/fbrun/FbRun.cc19
1 files changed, 18 insertions, 1 deletions
diff --git a/util/fbrun/FbRun.cc b/util/fbrun/FbRun.cc
index 321959e..b697187 100644
--- a/util/fbrun/FbRun.cc
+++ b/util/fbrun/FbRun.cc
@@ -214,6 +214,23 @@ bool FbRun::loadHistory(const char *filename) {
214 return true; 214 return true;
215} 215}
216 216
217bool FbRun::loadCompletion(const char *filename) {
218 if (!filename)
219 return false;
220 ifstream infile(filename);
221 if (!infile)
222 return false;
223
224 m_apps.clear();
225 string line;
226 while (getline(infile, line)) {
227 if (!line.empty()) // don't add empty lines
228 m_apps.push_back(line);
229 }
230 return true;
231}
232
233
217bool FbRun::loadFont(const string &fontname) { 234bool FbRun::loadFont(const string &fontname) {
218 if (!m_font.load(fontname.c_str())) 235 if (!m_font.load(fontname.c_str()))
219 return false; 236 return false;
@@ -472,7 +489,7 @@ void FbRun::tabCompleteApps() {
472 tabComplete(m_files, m_current_files_item); 489 tabComplete(m_files, m_current_files_item);
473 } else { 490 } else {
474 static bool first_run = true; 491 static bool first_run = true;
475 if (first_run) { 492 if (first_run && m_apps.empty()) {
476 first_run = false; 493 first_run = false;
477 std::string path = getenv("PATH"); 494 std::string path = getenv("PATH");
478 FbTk::Directory dir; 495 FbTk::Directory dir;