| 412 | } |
| 413 | |
| 414 | void TextField::cursorToLineStart() { |
| 415 | if (password) { |
| 416 | cursor = 0; |
| 417 | return; |
| 418 | } |
| 419 | size_t pos = text.rfind('\n', std::max(cursor - 1, 0)); |
| 420 | if (pos == std::string::npos) |
| 421 | cursor = 0; |
| 422 | else |
| 423 | cursor = std::min((int) pos + 1, (int) text.size()); |
| 424 | } |
| 425 | |
| 426 | void TextField::cursorToLineEnd() { |
| 427 | if (password) { |