From e1e28416d49b6496f1d5fb09328ae8e8c720223a Mon Sep 17 00:00:00 2001 From: Yousef Khadadeh Date: Fri, 28 Nov 2025 09:46:18 +0300 Subject: [PATCH] Improved tight word selection --- src/RichText/TextBox.cpp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/RichText/TextBox.cpp b/src/RichText/TextBox.cpp index c9c8d1a..03e5771 100644 --- a/src/RichText/TextBox.cpp +++ b/src/RichText/TextBox.cpp @@ -759,6 +759,16 @@ TextPosition TextBox::move(Movement movement, TextPosition pos, std::optionalisWhitespace(u)) + return pos; + } + std::string fullText = get_string(); size_t bytePosInFullText = get_byte_pos_from_text_pos(pos); @@ -776,7 +786,7 @@ TextPosition TextBox::move(Movement movement, TextPosition pos, std::optionalisWhitespace(u) || movement == Movement::LEFT_WORD_TIGHT) + if(!SkUnicodes::ICU::Make()->isWhitespace(u)) byteIndexToRet = nextByteIndex; } break; @@ -787,6 +797,16 @@ TextPosition TextBox::move(Movement movement, TextPosition pos, std::optionalisWhitespace(u)) + return pos; + } + std::string fullText = get_string(); size_t bytePosInFullText = get_byte_pos_from_text_pos(pos);