|
| 1 | +From c7bb26a38b1d5988cc45a60091a70b5e87ac36ba Mon Sep 17 00:00:00 2001 |
| 2 | +From: Joel Winarske <joel.winarske@gmail.com> |
| 3 | +Date: Mon, 10 Nov 2025 09:49:09 -0800 |
| 4 | +Subject: [PATCH] [fml] fixes text_input compiler warnings |
| 5 | + |
| 6 | +Upstream-Status: Inappropriate |
| 7 | + |
| 8 | +Signed-off-by: Joel Winarske <joel.winarske@gmail.com> |
| 9 | +--- |
| 10 | + .../shell/platform/common/text_input_model.cc | 14 +++++++------- |
| 11 | + 1 file changed, 7 insertions(+), 7 deletions(-) |
| 12 | + |
| 13 | +diff --git a/engine/src/flutter/shell/platform/common/text_input_model.cc b/engine/src/flutter/shell/platform/common/text_input_model.cc |
| 14 | +index a21fe1ff3ef..ef807409dc1 100644 |
| 15 | +--- a/engine/src/flutter/shell/platform/common/text_input_model.cc |
| 16 | ++++ b/engine/src/flutter/shell/platform/common/text_input_model.cc |
| 17 | +@@ -157,7 +157,7 @@ bool TextInputModel::Backspace() { |
| 18 | + // There is no selection. Delete the preceding codepoint. |
| 19 | + size_t position = selection_.position(); |
| 20 | + if (position != editable_range().start()) { |
| 21 | +- int count = IsTrailingSurrogate(text_.at(position - 1)) ? 2 : 1; |
| 22 | ++ int count = IsTrailingSurrogate(static_cast<char32_t>(text_.at(position - 1))) ? 2 : 1; |
| 23 | + text_.erase(position - count, count); |
| 24 | + selection_ = TextRange(position - count); |
| 25 | + if (composing_) { |
| 26 | +@@ -175,7 +175,7 @@ bool TextInputModel::Delete() { |
| 27 | + // There is no selection. Delete the preceding codepoint. |
| 28 | + size_t position = selection_.position(); |
| 29 | + if (position < editable_range().end()) { |
| 30 | +- int count = IsLeadingSurrogate(text_.at(position)) ? 2 : 1; |
| 31 | ++ int count = IsLeadingSurrogate(static_cast<char32_t>(text_.at(position))) ? 2 : 1; |
| 32 | + text_.erase(position, count); |
| 33 | + if (composing_) { |
| 34 | + composing_range_.set_end(composing_range_.end() - count); |
| 35 | +@@ -196,17 +196,17 @@ bool TextInputModel::DeleteSurrounding(int offset_from_cursor, int count) { |
| 36 | + count = i; |
| 37 | + break; |
| 38 | + } |
| 39 | +- start -= IsTrailingSurrogate(text_.at(start - 1)) ? 2 : 1; |
| 40 | ++ start -= IsTrailingSurrogate(static_cast<char32_t>(text_.at(start - 1))) ? 2 : 1; |
| 41 | + } |
| 42 | + } else { |
| 43 | + for (int i = 0; i < offset_from_cursor && start != max_pos; i++) { |
| 44 | +- start += IsLeadingSurrogate(text_.at(start)) ? 2 : 1; |
| 45 | ++ start += IsLeadingSurrogate(static_cast<char32_t>(text_.at(start))) ? 2 : 1; |
| 46 | + } |
| 47 | + } |
| 48 | + |
| 49 | + auto end = start; |
| 50 | + for (int i = 0; i < count && end != max_pos; i++) { |
| 51 | +- end += IsLeadingSurrogate(text_.at(start)) ? 2 : 1; |
| 52 | ++ end += IsLeadingSurrogate(static_cast<char32_t>(text_.at(start))) ? 2 : 1; |
| 53 | + } |
| 54 | + |
| 55 | + if (start == end) { |
| 56 | +@@ -271,7 +271,7 @@ bool TextInputModel::MoveCursorForward() { |
| 57 | + // Otherwise, move the cursor forward. |
| 58 | + size_t position = selection_.position(); |
| 59 | + if (position != editable_range().end()) { |
| 60 | +- int count = IsLeadingSurrogate(text_.at(position)) ? 2 : 1; |
| 61 | ++ int count = IsLeadingSurrogate(static_cast<char32_t>(text_.at(position))) ? 2 : 1; |
| 62 | + selection_ = TextRange(position + count); |
| 63 | + return true; |
| 64 | + } |
| 65 | +@@ -287,7 +287,7 @@ bool TextInputModel::MoveCursorBack() { |
| 66 | + // Otherwise, move the cursor backward. |
| 67 | + size_t position = selection_.position(); |
| 68 | + if (position != editable_range().start()) { |
| 69 | +- int count = IsTrailingSurrogate(text_.at(position - 1)) ? 2 : 1; |
| 70 | ++ int count = IsTrailingSurrogate(static_cast<char32_t>(text_.at(position - 1))) ? 2 : 1; |
| 71 | + selection_ = TextRange(position - count); |
| 72 | + return true; |
| 73 | + } |
| 74 | +-- |
| 75 | +2.51.1 |
| 76 | + |
0 commit comments