Files
Terminal.Gui/Tests
Tig 48d6e13138 Fixes #4466 - FillRect Corrupts Wide Characters When Overlapping (#4486)
* Improve wide character handling in output buffer

Enhances rendering and state management for wide (double-width) characters. Marks both cells as clean after rendering wide graphemes, ensures replacement cells are marked dirty when partially clipped, and uses Move/AddStr for proper wide character handling and invalidation.

* Fix FillRect to handle wide Unicode chars correctly

Refactored OutputBufferImpl.FillRect to properly handle wide (double-width) Unicode characters, fixing visual corruption when overwriting CJK text (e.g., with MessageBox borders). Removed the char-based FillRect overload in favor of Rune-based handling. Added helper methods for attribute/dirty management and wide glyph invalidation. Updated OutputBase.Write to always mark adjacent cells dirty for wide chars. Updated tests and added OutputBufferWideCharTests to verify correct behavior in all scenarios. This resolves issue #4466 and ensures robust rendering for wide Unicode text.

* Handle wide grapheme clusters in OutputBase rendering

Added logic to mark both cells of wide grapheme clusters as clean after rendering, preventing unnecessary redraws. Also included a commented-out preprocessor directive and using statement for potential future use.

* Clarify comment for IsDirty logic on wide graphemes

Updated the comment explaining why the next cell is marked clean (IsDirty = false) after handling wide graphemes, and added a reference to GitHub issue #4466 for context.

* Update test for dirty flag after wide glyph write

Adjusted OutputBaseTests to expect column 1's dirty flag to be cleared after writing a wide glyph to column 0, matching current OutputBase.Write behavior. Added clarifying comment and GitHub issue reference.

* Update Tests/UnitTestsParallelizable/Drivers/OutputBufferWideCharTests.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update Terminal.Gui/Drivers/OutputBufferImpl.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update Terminal.Gui/Drivers/OutputBase.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-12-12 16:57:29 -07:00
..

Terminal.Gui Tests

This folder contains the tests for Terminal.Gui.

./UnitTests

This folder contains the unit tests for Terminal.Gui that can not be run in parallel. This is because they depend on Application or other class that use static state or ConfigurationManager.

We should be striving to move as many tests as possible to the ./UnitTestsParallelizable folder.

./UnitTestsParallelizable

This folder contains the unit tests for Terminal.Gui that can be run in parallel.

./IntegrationTests

This folder contains the integration tests for Terminal.Gui.

./StressTests

This folder contains the stress tests for Terminal.Gui.

./PerformanceTests

This folder WILL contain the performance tests for Terminal.Gui.

See the Testing wiki for details on how to add more tests.