MCPcopy Create free account
hub / github.com/SpartanJ/eepp / goToNextError

Method goToNextError

src/tools/ecode/plugins/spellchecker/spellcheckerplugin.cpp:139–176  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

137}
138
139void 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
178void SpellCheckerPlugin::goToPrevError( UICodeEditor* editor ) {
179 if ( nullptr == editor || !editor->hasDocument() )

Callers

nothing calls this directly

Calls 12

getDocumentMethod · 0.80
normalizedMethod · 0.80
hasDocumentMethod · 0.45
startMethod · 0.45
getSelectionMethod · 0.45
findMethod · 0.45
endMethod · 0.45
emptyMethod · 0.45
goToLineMethod · 0.45
getSplitterMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected