Skip to content

Conversation

@gnodet
Copy link
Member

@gnodet gnodet commented May 7, 2025

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 using Arrays.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:

  1. Modifying the setSize method to fill the extended screen lines with spaces
  2. Adding a new test method testScreenLinesSpaceFillingOnWidthIncrease() to verify the fix works correctly
  3. Updating the copyright year in the test file to 2025

Testing

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

…n ScreenTerminal

When increasing the width of the terminal in ScreenTerminal.setSize(),
screen lines were extended using Arrays.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.

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.

Added a test to verify the fix works correctly.

Fixes #1231
@gnodet gnodet changed the title Fix: Properly fill screen lines with spaces when width is increased in ScreenTerminal fix: Properly fill screen lines with spaces when width is increased in ScreenTerminal May 7, 2025
@gnodet gnodet merged commit 396f5fe into master May 7, 2025
9 checks passed
@gnodet gnodet added this to the 3.29.1 milestone May 7, 2025
@gnodet gnodet added the bug label May 7, 2025
@gnodet gnodet deleted the fix-1231-screen-terminal-space-filling branch May 7, 2025 22:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing space-filling in ScreenTerminal

2 participants