"Pausing" is better than "muting"

This commit is contained in:
Marcin Kulik
2019-03-23 11:59:58 +01:00
committed by Marcin Kulik
parent 3ff14875ff
commit 53d0dbbfbb
3 changed files with 11 additions and 11 deletions

View File

@@ -137,9 +137,9 @@ By running `asciinema rec [filename]` you start a new recording session. The
command (process) that is recorded can be specified with `-c` option (see
below), and defaults to `$SHELL` which is what you want in most cases.
You can temporarily "mute" recording by pressing <kbd>Ctrl+P</kbd>. This is
useful when you want to execute some commands during the recording session that
should not be captured (e.g. pasting secrets). Un-mute by pressing
You can temporarily pause recording of terminal by pressing <kbd>Ctrl+P</kbd>.
This is useful when you want to execute some commands during the recording
session that should not be captured (e.g. pasting secrets). Resume by pressing
<kbd>Ctrl+P</kbd> again.
Recording finishes when you exit the shell (hit <kbd>Ctrl+D</kbd> or type

View File

@@ -18,7 +18,7 @@ from asciinema.term import raw
def record(command, writer, env=os.environ, rec_stdin=False, time_offset=0):
master_fd = None
start_time = None
muted = False
paused = False
def _set_pty_size():
'''
@@ -43,7 +43,7 @@ def record(command, writer, env=os.environ, rec_stdin=False, time_offset=0):
def _handle_master_read(data):
'''Handles new data on child process stdout.'''
if not muted:
if not paused:
writer.write_stdout(time.time() - start_time, data)
_write_stdout(data)
@@ -58,14 +58,14 @@ def record(command, writer, env=os.environ, rec_stdin=False, time_offset=0):
def _handle_stdin_read(data):
'''Handles new data on child process stdin.'''
nonlocal muted
nonlocal paused
if data == b'\x10': # ctrl+p
muted = not muted
paused = not paused
else:
_write_master(data)
if rec_stdin and not muted:
if rec_stdin and not paused:
writer.write_stdin(time.time() - start_time, data)
def _signals(signal_list):

View File

@@ -42,9 +42,9 @@ By running **asciinema rec [filename]** you start a new recording session. The
command (process) that is recorded can be specified with **-c** option (see
below), and defaults to **$SHELL** which is what you want in most cases.
You can temporarily "mute" recording by pressing <kbd>Ctrl+P</kbd>. This is
useful when you want to execute some commands during the recording session that
should not be captured (e.g. pasting secrets). Un-mute by pressing
You can temporarily pause recording of terminal by pressing <kbd>Ctrl+P</kbd>.
This is useful when you want to execute some commands during the recording
session that should not be captured (e.g. pasting secrets). Resume by pressing
<kbd>Ctrl+P</kbd> again.
Recording finishes when you exit the shell (hit <kbd>Ctrl+D</kbd> or type