Commit b6e4e966 authored by Eike Ziller's avatar Eike Ziller

Locator: Remove whitespace from start and end

It is not very intuitive, and can easily happen when copy&pasting into
locator.

Change-Id: I51d226b8e834c43eedc042035a9b90aa7ee4844f
Task-number: QTCREATORBUG-15399
Reviewed-by: default avatarDavid Schulz <david.schulz@theqtcompany.com>
parent 4a06fc63
......@@ -464,24 +464,25 @@ void LocatorWidget::showPopupNow()
QList<ILocatorFilter *> LocatorWidget::filtersFor(const QString &text, QString &searchText)
{
const QString trimmedText = text.trimmed();
QList<ILocatorFilter *> filters = m_locatorPlugin->filters();
const int whiteSpace = text.indexOf(QLatin1Char(' '));
const int whiteSpace = trimmedText.indexOf(QLatin1Char(' '));
QString prefix;
if (whiteSpace >= 0)
prefix = text.left(whiteSpace);
prefix = trimmedText.left(whiteSpace);
if (!prefix.isEmpty()) {
prefix = prefix.toLower();
QList<ILocatorFilter *> prefixFilters;
foreach (ILocatorFilter *filter, filters) {
if (prefix == filter->shortcutString()) {
searchText = text.mid(whiteSpace+1);
searchText = trimmedText.mid(whiteSpace).trimmed();
prefixFilters << filter;
}
}
if (!prefixFilters.isEmpty())
return prefixFilters;
}
searchText = text;
searchText = trimmedText;
QList<ILocatorFilter *> activeFilters;
foreach (ILocatorFilter *filter, filters)
if (filter->isIncludedByDefault())
......
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