fix: Properly fill screen lines with spaces when width is increased in ScreenTerminal #1236
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.
Description
This PR fixes issue #1231 where screen lines were not properly filled with spaces when the terminal width was increased in
ScreenTerminal.setSize().Problem
When increasing the width of the terminal in
ScreenTerminal.setSize(), screen lines were extended usingArrays.copyOf()without filling the new space with spaces. This caused rendering issues as the new elements were initialized with null characters (0's), which have no width.In contrast, history lines were properly handled by filling the extended space with spaces (attr | 0x00000020).
Solution
This fix ensures that when the terminal width is increased, all screen lines are properly filled with spaces (attr | 0x00000020), similar to how history lines are handled.
The changes include:
setSizemethod to fill the extended screen lines with spacestestScreenLinesSpaceFillingOnWidthIncrease()to verify the fix works correctlyTesting
Added a specific test that verifies no null characters are present in the terminal content after increasing the width. All tests pass successfully.
Fixes #1231