Handle untitled documents when filtering on path

These would previously be prefixed with the project folder path. Now they get no prefix (and disappear when the path-part of the filter string is non-empty).
This commit is contained in:
Allan Odgaard
2013-01-25 12:39:28 +01:00
parent 5adc29189e
commit 694b6defd8

View File

@@ -480,11 +480,11 @@ inline void rank_record (document_record_t& record, filter_string_t const& filte
std::vector<std::pair<size_t, size_t>> path_cover;
if(filter.path != NULL_STR)
{
std::string prefix = path::relative_to(path::parent(record.full_path), basePath);
std::string prefix = (record.full_path == NULL_STR) ? "" : path::relative_to(path::parent(record.full_path), basePath);
if(double rank = oak::rank(filter.path, prefix, &path_cover))
{
path_rank = 1 - rank;
record.display = prefix + (prefix.empty() ? "" : "/");
record.display = (record.full_path == NULL_STR) ? "" : prefix + (prefix.empty() ? "" : "/");
}
else
{