- string selection = getString(dialog_->browser);
- if (!fl_get_button(dialog_->check_fullpath)) {
- // contents in browser has filenames without path
- // reconstruct path from controller getContents
- string const files = controller().getContents(activeStyle, true);
- vector<string> const vec = getVectorFromString(files, "\n");
-
- // find line in files vector
- vector<string>::const_iterator it = vec.begin();
- for (; it != vec.end(); ++it) {
- if ((*it).find(selection) != string::npos) {
- selection = *it;
- break;
- }
- }
- }
- if (!selection.empty()) {
- controller().viewFile(selection);
- }
-
- // reset the browser so that the following single-click callback doesn't do anything
+ ContentsType::size_type const sel = fl_get_browser(ob);
+ ContentsType const & data = texdata_[activeStyle];
+ string file = data[sel-1];
+ if (!fl_get_button(dialog_->check_fullpath))
+ file = getTexFileFromList(data[sel-1],
+ controller().getFileType(activeStyle));
+ if (sel >= 1 && sel <= data.size())
+ controller().viewFile(file);
+
+ // reset the browser so that the following single-click
+ // callback doesn't do anything