fix(terminal): Fix vertical jumpiness by joining buffer lines with newlines
The terminal display was using which concatenated lines without separators, causing text to render incorrectly and appear to jump vertically. Changed to so lines are properly separated with newlines, allowing the terminal to render each line on its own row. The ANSI cursor positioning codes (\033[row;colH) added by effects like HUD and firehose still work correctly because: 1. \033[H moves cursor to (1,1) and \033[J clears screen 2. Newlines move cursor down for subsequent lines 3. Cursor positioning codes override the newline positions 4. This allows effects to position content at specific rows while the base content flows naturally with newlines
This commit is contained in:
@@ -110,7 +110,7 @@ class TerminalDisplay:
|
|||||||
buffer = render_border(buffer, self.width, self.height, fps, frame_time)
|
buffer = render_border(buffer, self.width, self.height, fps, frame_time)
|
||||||
|
|
||||||
# Write buffer with cursor home + erase down to avoid flicker
|
# Write buffer with cursor home + erase down to avoid flicker
|
||||||
output = "\033[H\033[J" + "".join(buffer)
|
output = "\033[H\033[J" + "\n".join(buffer)
|
||||||
sys.stdout.buffer.write(output.encode())
|
sys.stdout.buffer.write(output.encode())
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user