mirror of
https://github.com/asciinema/asciinema.git
synced 2025-12-16 03:38:03 +01:00
Fast-forwarding to the next breakpoint with ] key
This commit is contained in:
11
README.md
11
README.md
@@ -381,6 +381,9 @@ Breakpoints can be added to a recording in several ways:
|
|||||||
- for existing recording, by inserting breakpoint events (`"b"`) in the
|
- for existing recording, by inserting breakpoint events (`"b"`) in the
|
||||||
asciicast file, see [breakpoint event](doc/asciicast-v2.md#b---breakpoint)
|
asciicast file, see [breakpoint event](doc/asciicast-v2.md#b---breakpoint)
|
||||||
|
|
||||||
|
When replaying a recording with `asciinema play` you can fast-forward to the
|
||||||
|
next breakpoint by pressing `]` key (when paused).
|
||||||
|
|
||||||
Breakpoints can be useful in e.g. live demos: you can create a recording with
|
Breakpoints can be useful in e.g. live demos: you can create a recording with
|
||||||
breakpoints, then play it back during presentation, and have it stop wherever
|
breakpoints, then play it back during presentation, and have it stop wherever
|
||||||
you want to explain terminal contents in more detail.
|
you want to explain terminal contents in more detail.
|
||||||
@@ -463,8 +466,12 @@ idle_time_limit = 1
|
|||||||
pause_key = p
|
pause_key = p
|
||||||
|
|
||||||
; Define hotkey for stepping through playback, a frame at a time,
|
; Define hotkey for stepping through playback, a frame at a time,
|
||||||
; default: .
|
; default: . (dot)
|
||||||
step_key = ]
|
step_key = s
|
||||||
|
|
||||||
|
; Define hotkey for jumping to next breakpoint,
|
||||||
|
; default: ]
|
||||||
|
next_breakpoint_key = b
|
||||||
|
|
||||||
[notifications]
|
[notifications]
|
||||||
; Desktop notifications are displayed on certain occasions, e.g. when
|
; Desktop notifications are displayed on certain occasions, e.g. when
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ class PlayCommand(Command):
|
|||||||
self.key_bindings = {
|
self.key_bindings = {
|
||||||
"pause": config.play_pause_key,
|
"pause": config.play_pause_key,
|
||||||
"step": config.play_step_key,
|
"step": config.play_step_key,
|
||||||
|
"next_breakpoint": config.play_next_breakpoint_key,
|
||||||
}
|
}
|
||||||
|
|
||||||
def execute(self) -> int:
|
def execute(self) -> int:
|
||||||
|
|||||||
@@ -161,6 +161,10 @@ class Config:
|
|||||||
def play_step_key(self) -> Any:
|
def play_step_key(self) -> Any:
|
||||||
return self.__get_key("play", "step", ".")
|
return self.__get_key("play", "step", ".")
|
||||||
|
|
||||||
|
@property
|
||||||
|
def play_next_breakpoint_key(self) -> Any:
|
||||||
|
return self.__get_key("play", "next_breakpoint", "]")
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def notifications_enabled(self) -> bool:
|
def notifications_enabled(self) -> bool:
|
||||||
return self.config.getboolean(
|
return self.config.getboolean(
|
||||||
|
|||||||
@@ -101,6 +101,7 @@ class Player: # pylint: disable=too-few-public-methods
|
|||||||
idle_time_limit = idle_time_limit or asciicast.idle_time_limit
|
idle_time_limit = idle_time_limit or asciicast.idle_time_limit
|
||||||
pause_key = key_bindings.get("pause")
|
pause_key = key_bindings.get("pause")
|
||||||
step_key = key_bindings.get("step")
|
step_key = key_bindings.get("step")
|
||||||
|
next_breakpoint_key = key_bindings.get("next_breakpoint")
|
||||||
|
|
||||||
events = asciicast.events()
|
events = asciicast.events()
|
||||||
events = ev.to_relative_time(events)
|
events = ev.to_relative_time(events)
|
||||||
@@ -148,6 +149,16 @@ class Player: # pylint: disable=too-few-public-methods
|
|||||||
pause_elapsed_time = time_
|
pause_elapsed_time = time_
|
||||||
output.write(time_, event_type, text)
|
output.write(time_, event_type, text)
|
||||||
time_, event_type, text = next_event()
|
time_, event_type, text = next_event()
|
||||||
|
|
||||||
|
elif key == next_breakpoint_key:
|
||||||
|
while time_ is not None and event_type != "b":
|
||||||
|
output.write(time_, event_type, text)
|
||||||
|
time_, event_type, text = next_event()
|
||||||
|
|
||||||
|
if time_ is not None:
|
||||||
|
output.write(time_, event_type, text)
|
||||||
|
pause_elapsed_time = time_
|
||||||
|
time_, event_type, text = next_event()
|
||||||
else:
|
else:
|
||||||
while time_ is not None:
|
while time_ is not None:
|
||||||
elapsed_wall_time = time.time() - start_time
|
elapsed_wall_time = time.time() - start_time
|
||||||
|
|||||||
Reference in New Issue
Block a user