* 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. */
| 1313 | * Finds the start of word at pos when delta < 0 or the end of the word when delta >= 0. |
| 1314 | */ |
| 1315 | int 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 |
no test coverage detected