MCPcopy Create free account
hub / github.com/Predelnik/DSpellCheck / next_token_end_in_document

Method next_token_end_in_document

src/core/SpellChecker.cpp:192–211  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

190}
191
192TextPosition SpellChecker::next_token_end_in_document(TextPosition end) const {
193 TextPosition shift = 15;
194 auto prev_end = end;
195 auto length = m_editor.get_active_document_length();
196 if (end == length)
197 return end;
198 while (end > 0) {
199 end = std::min(end + shift, length);
200 auto mapped_str = m_editor.get_mapped_wstring_range(prev_end, end);
201 // finding any start before start which starts a token
202 auto index = next_token_end(mapped_str.str, 0);
203 if (index < static_cast<TextPosition>(mapped_str.str.length()))
204 return mapped_str.to_original_index(index);
205 if (end == length)
206 return end;
207 prev_end = end;
208 shift *= 2;
209 }
210 return end;
211}
212
213MappedWstring SpellChecker::get_visible_text() {
214 auto top_visible_line = m_editor.get_first_visible_line();

Callers

nothing calls this directly

Calls 3

to_original_indexMethod · 0.80

Tested by

no test coverage detected