Skip to content

Clear terminal in edit program on resize event#2401

Merged
SquidDev merged 1 commit intocc-tweaked:mc-1.20.xfrom
Wojbie:patch-1
Apr 21, 2026
Merged

Clear terminal in edit program on resize event#2401
SquidDev merged 1 commit intocc-tweaked:mc-1.20.xfrom
Wojbie:patch-1

Conversation

@Wojbie
Copy link
Copy Markdown
Contributor

@Wojbie Wojbie commented Mar 21, 2026

Issue:

In edit.lua program, when redrawing contents after term_resize events, redrawMenu and redrawText functions in some cases (if terminal has gotten bigger, and there is less text lines in edited file then height of terminal - 2) do not completely cover all areas of screen, letting it contain old data (usually old menu) from older resolution.
This is most visible if user has single line file, and attempts to run it on advanced computer. Resulting by opening and closing new multishell window, 2 resizes, to smaller and then to bigger resolution are most common way players can encounter this bug. Each run call causes new extra copies of old menu to stack in dead space in middle:
obraz

Proposed solution:

Simplest solution to this issue is what is proposed in this PR, just adding term.clear() call in term_resize handling code before redraws happens ensures all artifacts from before resize would be cleared. While it would be possible to create more complicated handling code, that would only clear deal lines between Text and Menu areas, it would not provide any benefits over this solution, as term_resize events already cause contents to move around.

@SquidDev SquidDev added bug A problem or unexpected behaviour with the mod. area-CraftOS This affects CraftOS, or any other Lua portions of the mod. labels Apr 21, 2026
@SquidDev
Copy link
Copy Markdown
Member

Thank you, and sorry for the delay in reviewing!

@SquidDev SquidDev merged commit a624f88 into cc-tweaked:mc-1.20.x Apr 21, 2026
3 checks passed
@Wojbie Wojbie deleted the patch-1 branch April 21, 2026 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-CraftOS This affects CraftOS, or any other Lua portions of the mod. bug A problem or unexpected behaviour with the mod.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants