Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

Commit

Permalink
Merge pull request #165 from facebookresearch/eric/optional-ttyplay-a…
Browse files Browse the repository at this point in the history
…ctions

Asciinema does not support saving and loading of cursors, and this ru…
  • Loading branch information
cdmatters authored Jun 8, 2021
2 parents fc2483a + c3f9462 commit b487d6c
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions nle/scripts/ttyplay.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
parser.add_argument(
"-s", "--speed", default=1.0, type=float, help="Set playback speed multiplier"
)
parser.add_argument("-a", "--print-actions", action="store_true", help="Print actions")
parser.add_argument(
"-p", "--peek", action="store_true", help="Peek mode (like tail -f)"
)
Expand Down Expand Up @@ -135,12 +136,13 @@ def process(f):
continue

if channel == 1: # Input channel.
os.write(
1, b"\033[s\033[26;0f\033[37;1mFrame %d:\033[0m " % frame
) # Save Cursor & Jump to L26
os.write(1, INPUTS[ord(data)].encode("ascii"))
os.write(1, b" " * 32)
os.write(1, b" \033[u") # Jump back Cursor
if FLAGS.print_actions:
os.write(
1, b"\033[s\033[26;0f\033[37;1mFrame %d:\033[0m " % frame
) # Save Cursor & Jump to L26
os.write(1, INPUTS[ord(data)].encode("ascii"))
os.write(1, b" " * 32)
os.write(1, b" \033[u") # Jump back Cursor
continue

if jump == 0 and prev is not None:
Expand Down

0 comments on commit b487d6c

Please sign in to comment.