Skip to content

Fix crash when inserting newlines rapidly#578

Open
bilaldev05 wants to merge 2 commits into
fleather-editor:masterfrom
bilaldev05:master
Open

Fix crash when inserting newlines rapidly#578
bilaldev05 wants to merge 2 commits into
fleather-editor:masterfrom
bilaldev05:master

Conversation

@bilaldev05

Copy link
Copy Markdown

This PR fixes an assertion failure in editable_box.dart when rapidly inserting new lines.

Under fast input, the document model can grow faster than the render tree updates, causing childAtPosition() to return null.

Instead of asserting, we now gracefully fallback to the last available child.

Steps to reproduce:

  1. Open demo app
  2. Hold Enter to insert many new lines
  3. Observe assertion error in console

After fix:
No assertion occurs and scrolling works normally.

Tested on:
Android (Pixel Fold)
Flutter 3.41.0

@codecov

codecov Bot commented Jun 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 88.10%. Comparing base (ebd507e) to head (ac696ee).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
...kages/fleather/lib/src/rendering/editable_box.dart 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #578      +/-   ##
==========================================
+ Coverage   85.72%   88.10%   +2.38%     
==========================================
  Files          50       63      +13     
  Lines        8096    10899    +2803     
==========================================
+ Hits         6940     9603    +2663     
- Misses       1156     1296     +140     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants