Feature: instant replay
By geor...@google.com on July 30, 2010 19:23 (imported from Google Code)
The Instant Replay feature allows you to go "back in time" in a way that the scrollback buffer does not handle. During interactive applications, information may disappear from the screen which can never be recovered. For example, using text-mode UIs for debugging lack the ability to review the past output of the debugger. In this feature, the user would open a toolbar with TiVo-like rewind/fast forward controls that would move back through time. Access to the scrollback buffer would not be possible in this mode; only the screen contents are replayed. The date/time currently shown would be displayed in the toolbar, along with the upper and lower bounds of time that can be time traveled to.
The implementation:
updateDirtyRects is called periodically from a timer or as the buffer is changed. Modify this function to perform a diff between the current screen and the screen as of the time of the last call. Runlength encode the diff and store it in memory in a fixed-size circular buffer. The buffer size can be adjusted as a global preference, and there is one per session. Once per N updates, save a "key frame" so that high-speed scrubbing is possible.
An additional feature would be to allow search to operate over the instant replay buffer. This would work by simulating a replay and doing a search on each "rendered frame", stopping when a match is found. The find functionality would be included in the instant replay toolbar.