From 9dddaefa20f116f869ec60d9e75d142c80df4f46 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Mon, 10 Feb 2025 01:13:09 -0500 Subject: [PATCH] For password TextFields, skip to beginning/end in cursorToPrevWord()/cursorToNextWord(). --- src/ui/TextField.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/ui/TextField.cpp b/src/ui/TextField.cpp index 66e25b64..8ca299de 100644 --- a/src/ui/TextField.cpp +++ b/src/ui/TextField.cpp @@ -343,6 +343,10 @@ void TextField::pasteClipboard() { } void TextField::cursorToPrevWord() { + if (password) { + cursor = 0; + return; + } // This works for valid UTF-8 text size_t pos = text.rfind(' ', std::max(cursor - 2, 0)); if (pos == std::string::npos) @@ -352,6 +356,10 @@ void TextField::cursorToPrevWord() { } void TextField::cursorToNextWord() { + if (password) { + cursor = text.size(); + return; + } // This works for valid UTF-8 text size_t pos = text.find(' ', std::min(cursor + 1, (int) text.size())); if (pos == std::string::npos)