Locator: Interpret file paths verbatim with "Open and Create"

When typing "f /tmp/test.txt:20" in locator, it would show "Open and
Create /tmp/test.txt:20", but then ask if "/tmp/test.txt" shall be
created.
Make the "Open and Create" take the text verbatim, so it creates "/tmp/
test.txt:20". Specifying a line/column for an empty file doesn't make
sense, and otherwise files with this file name cannot be created.

Change-Id: Ibdd37bfb51518b3077037e7017a759ec0fe116fa
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Eike Ziller
2021-06-11 16:21:12 +02:00
parent cb5d120724
commit a93d549be1

View File

@@ -152,7 +152,7 @@ QList<LocatorFilterEntry> FileSystemFilter::matchesFor(QFutureInterface<LocatorF
}
// "create and open" functionality
const QString fullFilePath = dirInfo.filePath(link.targetFilePath.fileName());
const QString fullFilePath = dirInfo.filePath(entryFileName);
const bool containsWildcard = entry.contains('?') || entry.contains('*');
if (!containsWildcard && !QFileInfo::exists(fullFilePath) && dirInfo.exists()) {
LocatorFilterEntry createAndOpen(this,