smart newlines

This commit is contained in:
Felix Pankratz 2025-07-21 15:31:56 +02:00
parent 868820a955
commit 70d2029a9f

View File

@ -128,15 +128,20 @@ def main():
kitty.hide_cursor() kitty.hide_cursor()
y, x = kitty.get_position() y, x = kitty.get_position()
print("\n" * 25, end="") height, width = kitty.get_terminal_size_pixel()
h_pix, w_pix = kitty.get_terminal_cell_size()
# the image requires height/cell_height lines
needed_lines = round(height/h_pix)
print("\n" * needed_lines, end="")
try: try:
if not args.external: if not args.external:
while True: while True:
pl.camera.Azimuth(1) pl.camera.Azimuth(1)
buf: BytesIO = BytesIO() buf: BytesIO = BytesIO()
pl.screenshot(buf, transparent_background=True, window_size=(512, 512)) pl.screenshot(buf, transparent_background=True, window_size=(height, width))
kitty.set_position(y - 25, x) kitty.set_position(y - needed_lines, 0)
kitty.draw_to_terminal(buf) kitty.draw_to_terminal(buf)
else: else:
pl.show() pl.show()