Skip to content

Conversation

@chunhtai
Copy link
Contributor

fixes #98458

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@flutter-dashboard flutter-dashboard bot added a: text input Entering text in a text field or keyboard related problems framework flutter/packages/flutter repository. See also f: labels. labels Feb 16, 2022
@chunhtai chunhtai requested a review from justinmc February 16, 2022 00:27
@chunhtai
Copy link
Contributor Author

a friendly bump

Copy link
Contributor

@justinmc justinmc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

Just a question below. Also CC @Renzo-Olivares just as a heads up, since this is somewhat related to rich text editing.

int? codeUnitAtVisitor(int index, Accumulator offset) {
return null;
offset.increment(1);
return PlaceholderSpan.placeholderCodeUnit.codeUnitAt(0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there any implications for doing this? Like I wonder, in the future if we support copying a WidgetSpan, will the plain text representation of the WidgetSpan be \uFFFC?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method is mainly used to calculate layout geometry. I would imagine the copying use the toPlainText instead, or something like toRichText. It has to return something when this method is called, returning null at index within a string seems counter-intuitive.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, it shouldn't matter at all for copying then. The \uFFFC character makes sense to me here, I think that's what I was using as a placeholder when messing around with rich text editing.

}) : super(style: style);

/// The unicode character to represent a placeholder.
static const String placeholderCodeUnit = '\uFFFC';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason no to define this as an int code unit = 0xFFFC?
This way you could call buffer.writeCharCode() and avoid doing the slightly confusing placeholderCodeUnit.codeUnitAt(0) conversion in widget_span.dart

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I published #98971 as this PR has been merged already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: text input Entering text in a text field or keyboard related problems framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RenderParagraph getOffsetForCaret does not work correct if it has WidgetSpan

4 participants