MCPcopy Create free account
hub / github.com/ProgerXP/Notepad2e / ExtendWordSelect

Method ExtendWordSelect

scintilla/src/Document.cxx:1315–1329  ·  view source on GitHub ↗

* Used by commmands that want to select whole words. * Finds the start of word at pos when delta < 0 or the end of the word when delta >= 0. */

Source from the content-addressed store, hash-verified

1313 * Finds the start of word at pos when delta < 0 or the end of the word when delta >= 0.
1314 */
1315int Document::ExtendWordSelect(int pos, int delta, bool onlyWordCharacters) {
1316 CharClassify::cc ccStart = CharClassify::ccWord;
1317 if (delta < 0) {
1318 if (!onlyWordCharacters)
1319 ccStart = WordCharClass(cb.CharAt(pos-1));
1320 while (pos > 0 && (WordCharClass(cb.CharAt(pos - 1)) == ccStart))
1321 pos--;
1322 } else {
1323 if (!onlyWordCharacters && pos < Length())
1324 ccStart = WordCharClass(cb.CharAt(pos));
1325 while (pos < (Length()) && (WordCharClass(cb.CharAt(pos)) == ccStart))
1326 pos++;
1327 }
1328 return MovePositionOutsideChar(pos, delta, true);
1329}
1330
1331/**
1332 * Find the start of the next word in either a forward (delta >= 0) or backwards direction

Callers 4

AutoCompleteCompletedMethod · 0.80
WordSelectionMethod · 0.80
ButtonDownMethod · 0.80
WndProcMethod · 0.80

Calls 1

CharAtMethod · 0.45

Tested by

no test coverage detected