Fixes #5639. Harden TextView text synchronization - #5645
Merged
YourRobotOverlord merged 3 commits intoAug 27, 2026
Merged
Conversation
Finalize history and drawing state before TextChanged and always clear the setter guard after subscriber failures.\n\nRefs tui-cs#5639
Consume the one-shot synchronization guard before TextChanged subscribers run so nested View.Text assignments reach the model.\n\nRefs tui-cs#5639
Contributor
There was a problem hiding this comment.
Pull request overview
Hardens TextView.Text synchronization and recovery by ensuring internal state updates complete before TextChanged dispatch, and by making the synchronization guard resilient to exceptions and reentrant polymorphic View.Text assignments (fixing #5639).
Changes:
- Reworks
TextView.Textsetter /OnTextChangedguard logic to clear the guard viafinallyand allow reentrant polymorphic sets to resync the internal model. - Finalizes draw + history baseline state before raising
TextChangedso exceptions don’t leaveTextViewinconsistent. - Adds regression tests covering throwing
TextChangedsubscribers, history baseline consistency, and reentrant polymorphic synchronization.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| Terminal.Gui/Views/TextInput/TextView/TextView.Text.cs | Makes TextView text sync guard exception-safe and reentrancy-safe while preserving CWP behavior. |
| Tests/UnitTestsParallelizable/ViewBase/TextCwpTests.cs | Adds regression coverage for exception recovery, history baseline consistency, and reentrant polymorphic syncing. |
Suppressed comments (2)
Tests/UnitTestsParallelizable/ViewBase/TextCwpTests.cs:195
- AI-generated test marker comment does not follow the required repository format.
.claude/rules/testing-patterns.mdspecifies the marker must be either// Claude - <model>or// CoPilot - <model>(both accepted).
// Codex - GPT-5.6
Tests/UnitTestsParallelizable/ViewBase/TextCwpTests.cs:208
- AI-generated test marker comment does not follow the required repository format.
.claude/rules/testing-patterns.mdspecifies the marker must be either// Claude - <model>or// CoPilot - <model>(both accepted).
// Codex - GPT-5.6
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
tig
approved these changes
Aug 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Hardens
TextView.Textsynchronization when post-change notification throws or performs a reentrant polymorphic assignment.Changes
TextChanged.finallyafter subscriber failures.View.Textassignments update the internal model.Testing
dotnet build --configuration Debug --no-restore— passed with 0 errors and 3 pre-existing XML documentation warnings.SchemeColorNoneDerivationTestsandViewDrawingClippingTests.To pull down this PR locally: