Commit de4fd54c authored by Eike Ziller's avatar Eike Ziller
Browse files

Fix that locator file filter couldn't open directories ending in + or :



There basically just no sense for directories to have line number
suffixes, so we just remove that part.

Task-number: QTCREATORBUG-8272
Change-Id: Ia103ed15cd7ab00fb2d5bb692423e8542722fa31
Reviewed-by: default avatarKai Koehne <kai.koehne@digia.com>
parent c6e47403
......@@ -45,11 +45,9 @@ FileSystemFilter::FileSystemFilter(EditorManager *editorManager, LocatorWidget *
setIncludedByDefault(false);
}
QList<FilterEntry> FileSystemFilter::matchesFor(QFutureInterface<Locator::FilterEntry> &future, const QString &entry_)
QList<FilterEntry> FileSystemFilter::matchesFor(QFutureInterface<Locator::FilterEntry> &future, const QString &entry)
{
QList<FilterEntry> value;
QString entry = entry_;
const QString lineNoSuffix = EditorManager::splitLineNumber(&entry);
QFileInfo entryInfo(entry);
QString name = entryInfo.fileName();
QString directory = entryInfo.path();
......@@ -81,11 +79,15 @@ QList<FilterEntry> FileSystemFilter::matchesFor(QFutureInterface<Locator::Filter
break;
if (dir != QLatin1String(".") && (name.isEmpty() || dir.startsWith(name, Qt::CaseInsensitive))) {
const QString fullPath = dirInfo.filePath(dir);
FilterEntry filterEntry(this, dir, QString(fullPath + lineNoSuffix));
FilterEntry filterEntry(this, dir, fullPath);
filterEntry.resolveFileIcon = true;
value.append(filterEntry);
}
}
// file names can match with +linenumber or :linenumber
name = entry;
const QString lineNoSuffix = EditorManager::splitLineNumber(&name);
name = QFileInfo(name).fileName();
foreach (const QString &file, files) {
if (future.isCanceled())
break;
......@@ -102,18 +104,15 @@ QList<FilterEntry> FileSystemFilter::matchesFor(QFutureInterface<Locator::Filter
void FileSystemFilter::accept(FilterEntry selection) const
{
QString file = selection.internalData.toString();
const QString lineNoSuffix = EditorManager::splitLineNumber(&file);
QFileInfo info(file);
if (info.isDir()) {
QString value = shortcutString();
value += QLatin1Char(' ');
value += QDir::toNativeSeparators(info.absoluteFilePath() + QLatin1Char('/'));
value += lineNoSuffix;
m_locatorWidget->show(value, value.length());
return;
}
EditorManager::openEditor(selection.internalData.toString(), Id(),
EditorManager::openEditor(file, Id(),
EditorManager::ModeSwitch | EditorManager::CanContainLineNumber);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment