Skip to content

fix: clear mistakes that fall out of new text range#97

Open
andrew-bekhiet-solid wants to merge 5 commits into
solid-software:mainfrom
andrew-bekhiet-solid:fix-filtering-mistakes-on-shorter-text
Open

fix: clear mistakes that fall out of new text range#97
andrew-bekhiet-solid wants to merge 5 commits into
solid-software:mainfrom
andrew-bekhiet-solid:fix-filtering-mistakes-on-shorter-text

Conversation

@andrew-bekhiet-solid

Copy link
Copy Markdown
Collaborator

fix: prevent notifying listeners after dispose

Fixes a bug where changing text programmatically throws a RangeError
For example changing text from "This text has a mistke" to "abc" throws RangeError because the offset of "mistke" is out of range on "abc"

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a _isDisposed flag to prevent operations on a disposed LanguageToolController and refactors _filterMistakesOnChanged to return a list while filtering out-of-bounds mistakes. The review feedback points out a potential bug where an invalid text selection causes incorrect mistake offset adjustments, and suggests removing a redundant .toList() call on the refactored method's result.

Comment thread lib/src/core/controllers/language_tool_controller.dart
Comment thread lib/src/core/controllers/language_tool_controller.dart Outdated

@solid-danylosafonov solid-danylosafonov left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

See comment in gemini thread

@solid-danylosafonov solid-danylosafonov self-requested a review June 8, 2026 18:41
@andrew-bekhiet-solid andrew-bekhiet-solid force-pushed the fix-filtering-mistakes-on-shorter-text branch from cd44b1e to ba39d5f Compare June 8, 2026 20:35
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