diff --git a/src/ui/TextField.cpp b/src/ui/TextField.cpp index 4506a80c..d86b5da3 100644 --- a/src/ui/TextField.cpp +++ b/src/ui/TextField.cpp @@ -61,7 +61,7 @@ void TextField::onSelectKey(const event::SelectKey& e) { if (pos == std::string::npos) cursor = 0; else - cursor = pos; + cursor = std::min((int) pos + 1, (int) text.size()); }; auto cursorToNextWord = [&]() { size_t pos = text.find(' ', std::min(cursor + 1, (int) text.size()));