Apparently this code in ttyplay is firing:

        case '0':
            speed = 0.0;
            break;

But, I am *not* pressing 0 on the keyboard!

The full text that ttyplay reads from stdin looks like this:

^[[>1;2801;0c

So vim originally sends a terminal escape sequence that causes the
terminal to respond with this, and the playback causes this to reoccur,
and be misinterpreted as a user pause request. I have not tried to look
up what the terminal response code here is used for, but there seem to
be several standard ones. http://www.termsys.demon.co.uk/vtansi.htm

One approach to fix this would be to ignore incoming terminal escape
sequences that come immediately after '\e'. An alternate approach
would be to try to filter out the recorded escape sequences that would
result in such responses. Another option would be to stop treating 0 and
1 on stdin as pause/unpause, and instead perhaps let the user press the
space bar to toggle playback. I've attached a patch that does that.

BTW, I can reproduce the problem with recordings taken in xterm and sakura
(a VTE based emulator), but not at the linux console.

-- 
see shy jo
From be5b8a05f5f31b928c43db977b01749ec02e790d Mon Sep 17 00:00:00 2001
From: Joey Hess <j...@kitenet.net>
Date: Wed, 14 Sep 2011 19:53:36 -0400
Subject: [PATCH] ttyplay: Use space bar to toggle pause. Closes: #641623

---
 debian/changelog |    2 +-
 ttyplay.c        |   12 +++++++-----
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 1f5e213..ede8613 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -5,7 +5,6 @@ ttyrec (1:1.0.8-4) unstable; urgency=low
   * ttyrec: Fix handling of screen resize. Closes: #564777
   * ttyplay -p: Fix race that could lead to corrupted playback. Closes: #564931
   * ttyrec: Add -e to man page synopsis. Closes: #558986
-  * ttyplay: Document pause key. Closes: #564942
   * ttyplay -p: Use inotify (linux). Closes: #564826
   * Build with -D_GNU_SOURCE, rather than -D_XOPEN_SOURCE. The latter
     breaks signal semantics needed by resize, and the former also exposes 
@@ -13,6 +12,7 @@ ttyrec (1:1.0.8-4) unstable; urgency=low
   * ttyplay -p: Display the current screenful of context when starting.
     Closes: #564776
   * ttyplay: Quit if q is pressed. Closes: #564952
+  * ttyplay: Use space bar to toggle pause. Closes: #641623
 
  -- Joey Hess <jo...@debian.org>  Sun, 30 May 2010 17:31:54 -0400
 
diff --git a/ttyplay.c b/ttyplay.c
index 4f7f790..222a393 100644
--- a/ttyplay.c
+++ b/ttyplay.c
@@ -123,11 +123,13 @@ ttywait (struct timeval prev, struct timeval cur, double speed)
         case 's':
             speed /= 2;
             break;
-        case '1':
-            speed = 1.0;
-            break;
-        case '0':
-            speed = 0.0;
+        case ' ':
+	    if (speed > 0) {
+		    speed = 0;
+	    }
+	    else {
+		    speed = 1.0;
+	    }
             break;
 	case 'q':
 	    printf("\n");
-- 
1.7.5.4

Attachment: signature.asc
Description: Digital signature

Reply via email to