Changeset View
Changeset View
Standalone View
Standalone View
addons/snippets/snippetcompletionmodel.cpp
Show First 20 Lines • Show All 170 Lines • ▼ Show 20 Line(s) | |||||
171 | } | 171 | } | ||
172 | 172 | | |||
173 | bool SnippetCompletionModel::shouldAbortCompletion(KTextEditor::View* view, const KTextEditor::Range& range, const QString& currentCompletion) | 173 | bool SnippetCompletionModel::shouldAbortCompletion(KTextEditor::View* view, const KTextEditor::Range& range, const QString& currentCompletion) | ||
174 | { | 174 | { | ||
175 | if(view->cursorPosition() < range.start() || view->cursorPosition() > range.end()) { | 175 | if(view->cursorPosition() < range.start() || view->cursorPosition() > range.end()) { | ||
176 | return true; //Always abort when the completion-range has been left | 176 | return true; //Always abort when the completion-range has been left | ||
177 | } | 177 | } | ||
178 | 178 | | |||
179 | for ( int i = 0; i < currentCompletion.length(); ++i ) { | 179 | for (const auto token : currentCompletion) { | ||
180 | if ( currentCompletion.at(i).isSpace() ) { | 180 | if ( token.isSpace() ) { | ||
181 | return true; | 181 | return true; | ||
182 | } | 182 | } | ||
183 | } | 183 | } | ||
184 | // else it's valid | 184 | // else it's valid | ||
185 | return false; | 185 | return false; | ||
186 | } | 186 | } | ||
187 | 187 | | |||
188 | 188 | |