Changeset View
Changeset View
Standalone View
Standalone View
src/completion/katecompletionmodel.cpp
Show First 20 Lines • Show All 2001 Lines • ▼ Show 20 Line(s) | 1996 | { | |||
---|---|---|---|---|---|
2002 | if (match.isEmpty()) { | 2002 | if (match.isEmpty()) { | ||
2003 | return PerfectMatch; | 2003 | return PerfectMatch; | ||
2004 | } | 2004 | } | ||
2005 | if (m_nameColumn.isEmpty()) { | 2005 | if (m_nameColumn.isEmpty()) { | ||
2006 | return NoMatch; | 2006 | return NoMatch; | ||
2007 | } | 2007 | } | ||
2008 | 2008 | | |||
2009 | matchCompletion = (m_nameColumn.startsWith(match, model->matchCaseSensitivity()) ? StartsWithMatch : NoMatch); | 2009 | matchCompletion = (m_nameColumn.startsWith(match, model->matchCaseSensitivity()) ? StartsWithMatch : NoMatch); | ||
2010 | if (matchCompletion == NoMatch) { | 2010 | if (! model->view()->config()->wordCompletionMatchFromWordStart() && matchCompletion == NoMatch) { | ||
2011 | // if no match, try for "contains" | 2011 | // If no match, and wordCompletionMatchFromWordStart() is false, try for "contains" | ||
2012 | // Only match when the occurrence is at a "word" beginning, marked by | 2012 | // Only match when the occurrence is at a "word" beginning, marked by | ||
2013 | // an underscore or a capital. So Foo matches BarFoo and Bar_Foo, but not barfoo. | 2013 | // an underscore or a capital. So Foo matches BarFoo and Bar_Foo, but not barfoo. | ||
2014 | // Starting at 1 saves looking at the beginning of the word, that was already checked above. | 2014 | // Starting at 1 saves looking at the beginning of the word, that was already checked above. | ||
2015 | if (containsAtWordBeginning(m_nameColumn, match, model->matchCaseSensitivity())) { | 2015 | if (containsAtWordBeginning(m_nameColumn, match, model->matchCaseSensitivity())) { | ||
2016 | matchCompletion = ContainsMatch; | 2016 | matchCompletion = ContainsMatch; | ||
2017 | } | 2017 | } | ||
2018 | } | 2018 | } | ||
2019 | 2019 | | |||
2020 | if (matchCompletion == NoMatch && !m_nameColumn.isEmpty() && !match.isEmpty()) { | 2020 | if (matchCompletion == NoMatch && !m_nameColumn.isEmpty() && !match.isEmpty()) { | ||
2021 | // if still no match, try abbreviation matching | 2021 | // if still no match, try abbreviation matching | ||
2022 | if (matchesAbbreviation(m_nameColumn, match, model->matchCaseSensitivity())) { | 2022 | if (matchesAbbreviation(m_nameColumn, match, model->matchCaseSensitivity())) { | ||
2023 | matchCompletion = AbbreviationMatch; | 2023 | matchCompletion = AbbreviationMatch; | ||
brauch: Maybe you want to set the flag here too? | |||||
brauch: Actually no, probably not. ;) | |||||
2024 | } | 2024 | } | ||
2025 | } | 2025 | } | ||
2026 | 2026 | | |||
2027 | if (matchCompletion && match.length() == m_nameColumn.length()) { | 2027 | if (matchCompletion && match.length() == m_nameColumn.length()) { | ||
2028 | if (model->matchCaseSensitivity() == Qt::CaseInsensitive && | 2028 | if (model->matchCaseSensitivity() == Qt::CaseInsensitive && | ||
2029 | model->exactMatchCaseSensitivity() == Qt::CaseSensitive && | 2029 | model->exactMatchCaseSensitivity() == Qt::CaseSensitive && | ||
2030 | !m_nameColumn.startsWith(match, Qt::CaseSensitive)) { | 2030 | !m_nameColumn.startsWith(match, Qt::CaseSensitive)) { | ||
2031 | return matchCompletion; | 2031 | return matchCompletion; | ||
▲ Show 20 Lines • Show All 401 Lines • Show Last 20 Lines |
Maybe you want to set the flag here too?