Skip to content

Commit aa1bb15

Browse files
committed
compose [nfc]: Make ComposeContentController.insertionIndex non-private
1 parent a140e3e commit aa1bb15

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/widgets/compose_box.dart

+5-5
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ class ComposeContentController extends ComposeController<ContentValidationError>
124124
/// gives the end of the whole text.
125125
///
126126
/// Expressed as a collapsed `TextRange` at the index.
127-
TextRange _insertionIndex() {
127+
TextRange insertionIndex() {
128128
final TextRange selection = value.selection;
129129
final String text = value.text;
130130
return selection.isValid
@@ -139,13 +139,13 @@ class ComposeContentController extends ComposeController<ContentValidationError>
139139
/// Assumes [newText] is not empty and consists entirely of complete lines
140140
/// (each line ends with a newline).
141141
///
142-
/// Inserts at [_insertionIndex]. If that's zero, no empty line is added before.
142+
/// Inserts at [insertionIndex]. If that's zero, no empty line is added before.
143143
///
144144
/// If there is already an empty line before or after, does not add another.
145145
void insertPadded(String newText) {
146146
assert(newText.isNotEmpty);
147147
assert(newText.endsWith('\n'));
148-
final i = _insertionIndex();
148+
final i = insertionIndex();
149149
final textBefore = text.substring(0, i.start);
150150
final String paddingBefore;
151151
if (textBefore.isEmpty || textBefore == '\n' || textBefore.endsWith('\n\n')) {
@@ -213,7 +213,7 @@ class ComposeContentController extends ComposeController<ContentValidationError>
213213
final placeholder = inlineLink('Uploading $filename...', null); // TODO(i18n)
214214
_uploads[tag] = (filename: filename, placeholder: placeholder);
215215
notifyListeners(); // _uploads change could affect validationErrors
216-
value = value.replaced(_insertionIndex(), '$placeholder\n\n');
216+
value = value.replaced(insertionIndex(), '$placeholder\n\n');
217217
return tag;
218218
}
219219

@@ -228,7 +228,7 @@ class ComposeContentController extends ComposeController<ContentValidationError>
228228
final int startIndex = text.indexOf(placeholder);
229229
final replacementRange = startIndex >= 0
230230
? TextRange(start: startIndex, end: startIndex + placeholder.length)
231-
: _insertionIndex();
231+
: insertionIndex();
232232

233233
value = value.replaced(
234234
replacementRange,

0 commit comments

Comments
 (0)