- // No matches
- string const tmp = input + _(" [no match]");
- show_information(tmp, input);
- } else if (comp.size() == 1) {
- // Perfect match
- string const tmp =
- comp[0] + _(" [sole completion]");
- show_information(tmp, comp[0] + " ");
- } else {
- // More that one match
- // Find maximal avaliable prefix
- string const tmp = comp[0];
- string test(input);
- if (tmp.length() > test.length())
- test += tmp[test.length()];
- while (test.length() < tmp.length()) {
- vector<string> vtmp;
- lyx::copy_if(comp.begin(),
- comp.end(),
- back_inserter(vtmp),
- prefix(test));
- if (vtmp.size() != comp.size()) {
- test.erase(test.length() - 1);
- break;
- }
- test += tmp[test.length()];
- }
- set_input(test);
-
- int x,y,w,h;
- fl_get_wingeometry(fl_get_real_object_window(the_buffer),
- &x, &y, &w, &h);
-
- // asynchronous completion
- int const air = the_buffer->x;
- x += air;
- y += h - (the_buffer->h + air);
- w = the_buffer->w;
- dropdown_->select(comp, x, y, w);
+ set_input(new_input);
+ show_info(_("[only completion]"), new_input + ' ');
+ break;
+ }
+
+ set_input(new_input);
+
+ // Fill freebrowser_'s browser with the list of
+ // available completions
+ FL_OBJECT * browser = freebrowser_->browser;
+ fl_clear_browser(browser);
+ vector<string>::const_iterator cit = comp.begin();
+ vector<string>::const_iterator end = comp.end();
+ for (; cit != end; ++cit) {
+ fl_add_browser_line(browser, cit->c_str());