@@ -128,20 +128,23 @@ def run(
128128 new_frame = False
129129 # Check terminal size
130130 new_size = app_session .output .get_size ()
131- maybe_clear_prefix , maybe_clear_suffix = b"" , b""
132131 if new_size != (height , width ):
133- # Write video frame with clear sequence inside synchronized output mode (DEC
134- # 2026) to prevent flicker, and, set last_frame as inverse of the current frame
135- # to ensure a full redraw by the blitter
136- maybe_clear_prefix = b"\033 [?2026h\033 [H\033 [2J"
137- maybe_clear_suffix = b"\033 [?2026l"
132+ maybe_clear_seq = b"\033 [H\033 [2J"
138133 height , width = new_size
139134 refx , refy = get_ref (width , height , console )
140135 last_frame = ~ video
141- # Render frame
142- video_data = maybe_clear_prefix + blit (
143- video , last_frame , refx , refy , width - 1 , height , color_mode
144- ) + maybe_clear_suffix
136+ else :
137+ maybe_clear_seq = b""
138+ # Render frame with synchronized output mode (DEC 2026) to prevent flickering
139+ # when the screen is cleared, or an artificial CRT-like "rolling band" side-effects
140+ # from fast "sprite blinking" meant to cause "transparency" effect on original HW,
141+ # https://zladx.github.io/posts/links-awakening-partial-translucency
142+ video_data = (
143+ b"\033 [?2026h"
144+ + maybe_clear_seq
145+ + blit (video , last_frame , refx , refy , width - 1 , height , color_mode )
146+ + b"\033 [?2026l"
147+ )
145148 last_frame = video .copy ()
146149 # Update reporting
147150 data_length .append (len (video_data ))
0 commit comments