From 22538d6697e448b20d2ae0f0c66161f85e540c00 Mon Sep 17 00:00:00 2001
From: Rob Sayre <sayrer@gmail.com>
Date: Sat, 25 Jun 2011 09:42:59 -0700
Subject: [PATCH 1/3] Make the log auto-scroll if the scrollbar is near the
 bottom, but maintain position if it isn't.

---
 test/test_slave.html | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/test/test_slave.html b/test/test_slave.html
index d685eeaf2..5652a5860 100644
--- a/test/test_slave.html
+++ b/test/test_slave.html
@@ -194,9 +194,17 @@ function clear(ctx) {
   ctx.restore();
 }
 
+/* Auto-scroll if the scrollbar is near the bottom, otherwise do
+nothing. */
+function checkScrolling() {
+  if ((stdout.scrollHeight - stdout.scrollTop) <= stdout.offsetHeight) {
+     stdout.scrollTop = stdout.scrollHeight;
+  }
+}
+
 function log(str) {
   stdout.innerHTML += str;
-  window.scrollTo(0, stdout.getBoundingClientRect().bottom);
+  checkScrolling();
 }
   </script>
 </head>

From d0544a351126d639a0553970696ff1bc82759974 Mon Sep 17 00:00:00 2001
From: Rob Sayre <sayrer@gmail.com>
Date: Sat, 25 Jun 2011 09:51:27 -0700
Subject: [PATCH 2/3] Fix whitespace.

---
 test/test_slave.html | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/test/test_slave.html b/test/test_slave.html
index 71ec7cacc..303a58c9b 100644
--- a/test/test_slave.html
+++ b/test/test_slave.html
@@ -200,8 +200,7 @@ function clear(ctx) {
   ctx.restore();
 }
 
-/* Auto-scroll if the scrollbar is near the bottom, otherwise do
-nothing. */
+/* Auto-scroll if the scrollbar is near the bottom, otherwise do nothing. */
 function checkScrolling() {
   if ((stdout.scrollHeight - stdout.scrollTop) <= stdout.offsetHeight) {
      stdout.scrollTop = stdout.scrollHeight;

From ee954d8c0aa18e3fe4e765eb0d23cc3cde67103a Mon Sep 17 00:00:00 2001
From: Rob Sayre <sayrer@gmail.com>
Date: Sat, 25 Jun 2011 11:02:35 -0700
Subject: [PATCH 3/3] Still more whitespace fixing.

---
 test/test_slave.html | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/test_slave.html b/test/test_slave.html
index 303a58c9b..07ac87388 100644
--- a/test/test_slave.html
+++ b/test/test_slave.html
@@ -203,7 +203,7 @@ function clear(ctx) {
 /* Auto-scroll if the scrollbar is near the bottom, otherwise do nothing. */
 function checkScrolling() {
   if ((stdout.scrollHeight - stdout.scrollTop) <= stdout.offsetHeight) {
-     stdout.scrollTop = stdout.scrollHeight;
+    stdout.scrollTop = stdout.scrollHeight;
   }
 }