| 389 | } |
| 390 | |
| 391 | void TextField::cursorToPrevWord() { |
| 392 | if (password) { |
| 393 | cursor = 0; |
| 394 | return; |
| 395 | } |
| 396 | size_t pos = text.rfind(' ', std::max(cursor - 2, 0)); |
| 397 | if (pos == std::string::npos) |
| 398 | cursor = 0; |
| 399 | else |
| 400 | cursor = std::min((int) pos + 1, (int) text.size()); |
| 401 | } |
| 402 | |
| 403 | void TextField::cursorToNextWord() { |
| 404 | if (password) { |