forked from genewildish/Mainline
Bug: Terminal display width wobble - inconsistent width measurement #25
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
Terminal display has inconsistent width measurement causing rendering to "wobble" - content shifts horizontally on each frame.
Symptoms
Root Cause Analysis Needed
Potential sources:
os.get_terminal_size()being called inconsistentlytw()vsget_terminal_size()vs cached valuesFiles to Investigate
engine/terminal.py-tw()functionengine/viewport.py-tw()functionengine/display/backends/terminal.py-init()andget_dimensions()engine/app.py- dimension handling in run_pipeline_mode()Status
Open - Root cause TBD
Root Cause Analysis
The terminal display "wobble" was caused by multiple issues:
1. Missing Screen Clear (Primary Cause)
TerminalDisplay.show()was appending new content without clearing the previous frame, causing old content to remain and creating visual jumping.Fix: Added
\033[H\033[J(cursor home + erase down) before each frame inengine/display/backends/terminal.py.2. CameraStage AttributeError (Secondary)
CameraStage tried to set read-only
viewport_width/viewport_heightproperties (they're computed fromcanvas_size / zoom), causing an AttributeError each frame.Fix: Changed to use
set_canvas_size()method inengine/pipeline/adapters.py.3. Glitch Effect Issues (Tertiary)
\033[row;1H) which conflicted with HUD and border renderingFix: Removed cursor positioning, pad to original visible width in
effects_plugins/glitch.py.4. Fade Effect Bug
Returned empty string when fade=0 instead of preserving original line.
Fix: Return original line when fade=0 in
effects_plugins/fade.py.5. Noise Effect Bug
Used
terminal_widthinstead of input line length, causing dimension mismatches.Fix: Use
len(original_line)ineffects_plugins/noise.py.Tests Added
tests/test_glitch_effect.py- 12 tests for effect dimension stabilitytests/test_display.py- screen clear regression teststests/test_pipeline.py- CameraStage regression test