Convert output format txt dont ignore clear commands
Pre-submission checks
- I have searched existing issues and this bug has not been reported yet
- This is a bug report for asciinema CLI (not player or server)
Bug Description
Hello !
When I use asciinema to record my shell commands, I expected the command asciinema convert -f txt to display the complete shell history, but when the clear command or the CTRL+L shortcut is used in the shell, the output of the convert command is truncated and only the commands following the last clear operation are displayed.
I might have expected this behavior with the raw format (although it would be nice if the clear action could be ignored in this mode as well), but with the txt format, I would expect all the input and output from my session to be displayed...
Steps to Reproduce
- Run the command
asciinema rec -i 2 --quiet --command "bash" --title "testing" /tmp/log.asciinema - In the session run
echo "before clear"
clear
echo "after clear"
<ctrl+l>
echo "after ctrl+l"
exit- Run
asciinema convert -f txt /tmp/log.asciinema -The output only show the lastecho "after ctrl+l"andexitcommand.
Expected Behavior
The command asciinema convert -f txt can display the full shell history without truncating the output after a clear or CTRL+L command.
Operating System
Fedora 43
asciinema CLI Version
3.2.0
Installation Method
Downloaded binary
Terminal Information
bash
Additional Context
When I edit the file, I can manually delete the following line, and the clear command will not be executed, so the convert command will not truncate the result:
[0.001, "o", "\u001b[H\u001b[2J\u001b[3J"]
The Ctrl+L shortcut inserts a separate line that I can delete manually to prevent text from being cut off:
[0.000, "o", "\u001b[H\u001b[2J\u001b]133;D;0\u001b\\\u001b]133;A\u001b\\\u001b[0m\u001b[1m\u001b[32mdramelac@hostname\u001b[0m:\u001b[1m\u001b[32m/tmp\u001b[0m$ \u001b]133;B\u001b\\"]
I found out that I can filter out with out the one of the following commands :
sed 's/\\u001b\[H\\u001b\[2J//g' /path/to/log.file | asciinema convert -f txt - -
grep -v '\\u001b\[H\\u001b\[2J' /path/to/log.file | asciinema convert -f txt - -Could the sequence be filtered out by default by asciinema as a control sequences ?
Source: asciinema/asciinema