Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 0561a98

Browse files
authored
Add missing header guard, namespace (#24423)
TextRange was missing a namespace declaration and header guards.
1 parent 5659b56 commit 0561a98

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

shell/platform/common/text_range.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,15 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5+
#ifndef FLUTTER_SHELL_PLATFORM_COMMON_TEXT_RANGE_H_
6+
#define FLUTTER_SHELL_PLATFORM_COMMON_TEXT_RANGE_H_
7+
58
#include <algorithm>
69

710
#include "flutter/fml/logging.h"
811

12+
namespace flutter {
13+
914
// A directional range of text.
1015
//
1116
// A |TextRange| describes a range of text with |base| and |extent| positions.
@@ -92,3 +97,7 @@ class TextRange {
9297
size_t base_;
9398
size_t extent_;
9499
};
100+
101+
} // namespace flutter
102+
103+
#endif // FLUTTER_SHELL_PLATFORM_COMMON_TEXT_RANGE_H_

shell/platform/linux/fl_text_input_plugin.cc

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ static void update_editing_state(FlTextInputPlugin* self) {
113113
fl_value_append_take(args, fl_value_new_int(priv->client_id));
114114
g_autoptr(FlValue) value = fl_value_new_map();
115115

116-
TextRange selection = priv->text_model->selection();
116+
flutter::TextRange selection = priv->text_model->selection();
117117
fl_value_set_string_take(
118118
value, kTextKey,
119119
fl_value_new_string(priv->text_model->GetText().c_str()));
@@ -195,7 +195,8 @@ static void im_preedit_changed_cb(FlTextInputPlugin* self) {
195195
&cursor_offset);
196196
cursor_offset += priv->text_model->composing_range().base();
197197
priv->text_model->UpdateComposingText(buf);
198-
priv->text_model->SetSelection(TextRange(cursor_offset, cursor_offset));
198+
priv->text_model->SetSelection(
199+
flutter::TextRange(cursor_offset, cursor_offset));
199200

200201
update_editing_state(self);
201202
}
@@ -311,7 +312,8 @@ static FlMethodResponse* set_editing_state(FlTextInputPlugin* self,
311312
}
312313

313314
priv->text_model->SetText(text);
314-
priv->text_model->SetSelection(TextRange(selection_base, selection_extent));
315+
priv->text_model->SetSelection(
316+
flutter::TextRange(selection_base, selection_extent));
315317

316318
int64_t composing_base =
317319
fl_value_get_int(fl_value_lookup_string(args, kComposingBaseKey));
@@ -323,7 +325,7 @@ static FlMethodResponse* set_editing_state(FlTextInputPlugin* self,
323325
size_t composing_start = std::min(composing_base, composing_extent);
324326
size_t cursor_offset = selection_base - composing_start;
325327
priv->text_model->SetComposingRange(
326-
TextRange(composing_base, composing_extent), cursor_offset);
328+
flutter::TextRange(composing_base, composing_extent), cursor_offset);
327329
}
328330

329331
return FL_METHOD_RESPONSE(fl_method_success_response_new(nullptr));

0 commit comments

Comments
 (0)