mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-29 00:35:00 +00:00
feat: set screen size from asciinema cast header
This commit is contained in:
parent
3daf632384
commit
91cef71048
1 changed files with 9 additions and 4 deletions
|
@ -16,15 +16,20 @@ def main():
|
||||||
input_file = sys.argv[1]
|
input_file = sys.argv[1]
|
||||||
output_file = sys.argv[2]
|
output_file = sys.argv[2]
|
||||||
|
|
||||||
# Initialize pyte screen and stream
|
|
||||||
screen = pyte.Screen(80, 24)
|
|
||||||
stream = pyte.Stream(screen)
|
|
||||||
|
|
||||||
# Read and parse the cast file
|
# Read and parse the cast file
|
||||||
with open(input_file, "r") as f:
|
with open(input_file, "r") as f:
|
||||||
# First line is header
|
# First line is header
|
||||||
header = f.readline().strip()
|
header = f.readline().strip()
|
||||||
|
|
||||||
|
# Parse header to extract terminal dimensions
|
||||||
|
header_data = json.loads(header)
|
||||||
|
width = header_data.get("width", 80)
|
||||||
|
height = header_data.get("height", 24)
|
||||||
|
|
||||||
|
# Initialize pyte screen and stream with dimensions from header
|
||||||
|
screen = pyte.Screen(width, height)
|
||||||
|
stream = pyte.Stream(screen)
|
||||||
|
|
||||||
# Read the events
|
# Read the events
|
||||||
events = [json.loads(line) for line in f if line.strip()]
|
events = [json.loads(line) for line in f if line.strip()]
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue