| 137 | } |
| 138 | |
| 139 | void SpellCheckerPlugin::goToNextError( UICodeEditor* editor ) { |
| 140 | if ( nullptr == editor || !editor->hasDocument() ) |
| 141 | return; |
| 142 | TextDocument* doc = &editor->getDocument(); |
| 143 | auto pos = doc->getSelection().start(); |
| 144 | |
| 145 | Lock l( mMatchesMutex ); |
| 146 | auto fMatch = mMatches.find( doc ); |
| 147 | if ( fMatch == mMatches.end() ) |
| 148 | return; |
| 149 | const auto& matches = fMatch->second; |
| 150 | if ( matches.empty() ) |
| 151 | return; |
| 152 | |
| 153 | const SpellCheckerMatch* matched = nullptr; |
| 154 | for ( const auto& match : matches ) { |
| 155 | if ( match.first >= pos.line() ) { |
| 156 | for ( const auto& m : match.second ) { |
| 157 | if ( pos < m.range.normalized().start() ) { |
| 158 | matched = &m; |
| 159 | break; |
| 160 | } |
| 161 | } |
| 162 | if ( matched ) |
| 163 | break; |
| 164 | } |
| 165 | } |
| 166 | |
| 167 | if ( matched != nullptr ) { |
| 168 | editor->goToLine( matched->range.start() ); |
| 169 | mManager->getSplitter()->addCurrentPositionToNavigationHistory(); |
| 170 | return; |
| 171 | } else if ( matches.begin()->second.front().range.start().line() != pos.line() ) { |
| 172 | editor->goToLine( matches.begin()->second.front().range.start() ); |
| 173 | mManager->getSplitter()->addCurrentPositionToNavigationHistory(); |
| 174 | return; |
| 175 | } |
| 176 | } |
| 177 | |
| 178 | void SpellCheckerPlugin::goToPrevError( UICodeEditor* editor ) { |
| 179 | if ( nullptr == editor || !editor->hasDocument() ) |
nothing calls this directly
no test coverage detected