twin: implement Scroll and Noscroll - plan9port - [fork] Plan 9 from user space
git clone git://src.adamsgaard.dk/plan9port
Log
Files
Refs
README
LICENSE
---
commit e1118cf27c9f66dfc90d2ead51a25602335bf9bf
parent fa580e2116da0709c1e48b280722f0c18ef3fd73
Author: Russ Cox 
Date:   Thu, 13 Nov 2008 15:39:56 -0800

win: implement Scroll and Noscroll

Diffstat:
  M src/cmd/9term/win.c                 |      14 +++++++++++++-

1 file changed, 13 insertions(+), 1 deletion(-)
---
diff --git a/src/cmd/9term/win.c b/src/cmd/9term/win.c
t@@ -171,7 +171,7 @@ threadmain(int argc, char **argv)
         putenv("winid", buf);
         sprint(buf, "%d/tag", id);
         fd = fsopenfd(fs, buf, OWRITE|OCEXEC);
-        write(fd, " Send Delete", 12);
+        write(fd, " Send Noscroll", 1+4+1+8);
         close(fd);
         sprint(buf, "%d/event", id);
         eventfd = fsopen(fs, buf, ORDWR|OCEXEC);
t@@ -202,6 +202,8 @@ threadmain(int argc, char **argv)
         fswrite(ctlfd, buf, strlen(buf));
         sprint(buf, "dump %s\n", dump);
         fswrite(ctlfd, buf, strlen(buf));
+        sprint(buf, "scroll");
+        fswrite(ctlfd, buf, strlen(buf));
         
         updatewinsize(25, 80, 0, 0);
         proccreate(stdoutproc, nil, STACK);
t@@ -402,6 +404,16 @@ stdinproc(void *v)
                                         e2.flag = e.flag;
                                         e = e2;
                                 }
+                                char buf[100];
+                                snprint(buf, sizeof buf, "%.*S", e.nr, e.r);
+                                if(cistrcmp(buf, "scroll") == 0) {
+                                        fsprint(ctlfd, "scroll\nshow");
+                                        break;
+                                }
+                                if(cistrcmp(buf, "noscroll") == 0) {
+                                        fsprint(ctlfd, "noscroll");
+                                        break;
+                                }
                                 if(e.flag & 8){
                                         if(e.q1 != e.q0){
                                                 sende(&e, fd0, cfd, afd, dfd, 0);