tmerge - plan9port - [fork] Plan 9 from user space
git clone git://src.adamsgaard.dk/plan9port
Log
Files
Refs
README
LICENSE
---
commit 210d461c87a6c5f598ef958b303a7f24d4e4a93b
parent 7064acbd104d7c1af5a94533213d2bb124a7a60e
Author: Russ Cox 
Date:   Wed, 12 Oct 2011 13:19:04 -0400

merge

Diffstat:
  M src/cmd/9term/9term.c               |      20 +++++++++++++++-----
  M src/cmd/9term/dat.h                 |       3 ++-
  M src/cmd/9term/fns.h                 |       2 +-
  M src/cmd/9term/wind.c                |      10 +++++++---

4 files changed, 25 insertions(+), 10 deletions(-)
---
diff --git a/src/cmd/9term/9term.c b/src/cmd/9term/9term.c
t@@ -67,7 +67,7 @@ threadmain(int argc, char *argv[])
                 fontname = EARGF(usage());
                 break;
         case 's':
-                /* no-op */
+                scrolling = TRUE;
                 break;
         case 'c':
                 cooked = TRUE;
t@@ -114,7 +114,7 @@ threadmain(int argc, char *argv[])
         timerinit();
         servedevtext();
         rcpid = rcstart(argc, argv, &rcfd, &sfd);
-        w = new(screen, FALSE, rcpid, ".", nil, nil);
+        w = new(screen, FALSE, scrolling, rcpid, ".", nil, nil);
 
         threadcreate(keyboardthread, nil, STACK);
         threadcreate(mousethread, nil, STACK);
t@@ -241,7 +241,7 @@ wpointto(Point pt)
 }
 
 Window*
-new(Image *i, int hideit, int pid, char *dir, char *cmd, char **argv)
+new(Image *i, int hideit, int scrollit, int pid, char *dir, char *cmd, char **argv)
 {
         Window *w;
         Mousectl *mc;
t@@ -258,7 +258,7 @@ new(Image *i, int hideit, int pid, char *dir, char *cmd, char **argv)
         *mc = *mousectl;
 /*        mc->image = i; */
         mc->c = cm;
-        w = wmk(i, mc, ck, cctl);
+        w = wmk(i, mc, ck, cctl, scrollit);
         free(mc);        /* wmk copies *mc */
         window = erealloc(window, ++nwindow*sizeof(Window*));
         window[nwindow-1] = w;
t@@ -288,6 +288,7 @@ enum
         Snarf,
         Plumb,
         Send,
+        Scroll,
         Cook
 };
 
t@@ -298,6 +299,7 @@ char                *menu2str[] = {
         "plumb",
         "send",
         "cook",
+        "scroll",
         nil
 };
 
t@@ -315,6 +317,10 @@ button2menu(Window *w)
         if(w->deleted)
                 return;
         incref(&w->ref);
+        if(w->scrolling)
+                menu2str[Scroll] = "noscroll";
+        else
+                menu2str[Scroll] = "scroll";
         if(cooked)
                 menu2str[Cook] = "nocook";
         else
t@@ -358,7 +364,11 @@ button2menu(Window *w)
                 wsetselect(w, w->nr, w->nr);
                 wshow(w, w->nr);
                 break;
-        
+
+        case Scroll:
+                if(w->scrolling ^= 1)
+                        wshow(w, w->nr);
+                break;
         case Cook:
                 cooked ^= 1;
                 break;
diff --git a/src/cmd/9term/dat.h b/src/cmd/9term/dat.h
t@@ -132,6 +132,7 @@ struct Window
         Rectangle                lastsr;
         int                        topped;
         int                        notefd;
+        uchar                scrolling;
         Cursor                cursor;
         Cursor                *cursorp;
         uchar                holding;
t@@ -149,7 +150,7 @@ int                winborder(Window*, Point);
 void                winctl(void*);
 void                winshell(void*);
 Window*        wlookid(int);
-Window*        wmk(Image*, Mousectl*, Channel*, Channel*);
+Window*        wmk(Image*, Mousectl*, Channel*, Channel*, int);
 Window*        wpointto(Point);
 Window*        wtop(Point);
 void                wtopme(Window*);
diff --git a/src/cmd/9term/fns.h b/src/cmd/9term/fns.h
t@@ -6,7 +6,7 @@ int        whide(Window*);
 int        wunhide(int);
 void        freescrtemps(void);
 int        parsewctl(char**, Rectangle, Rectangle*, int*, int*, int*, int*, char**, char*, char*);
-Window *new(Image*, int, int, char*, char*, char**);
+Window *new(Image*, int, int, int, char*, char*, char**);
 void        riosetcursor(Cursor*, int);
 int        min(int, int);
 int        max(int, int);
diff --git a/src/cmd/9term/wind.c b/src/cmd/9term/wind.c
t@@ -17,7 +17,7 @@
 
 enum
 {
-        HiWater        = 640000,        /* max size of history */
+        HiWater        = 64000000,        /* max size of history */
         LoWater        = 400000,        /* min size of history after max'ed */
         MinWater        = 20000        /* room to leave available when reallocating */
 };
t@@ -36,7 +36,7 @@ static        Image        *lightholdcol;
 static        Image        *paleholdcol;
 
 Window*
-wmk(Image *i, Mousectl *mc, Channel *ck, Channel *cctl)
+wmk(Image *i, Mousectl *mc, Channel *ck, Channel *cctl, int scrolling)
 {
         Window *w;
         Rectangle r;
t@@ -77,6 +77,7 @@ wmk(Image *i, Mousectl *mc, Channel *ck, Channel *cctl)
         w->topped = ++topped;
         w->id = ++id;
         w->notefd = -1;
+        w->scrolling = scrolling;
         w->dir = estrdup(startdir);
         w->label = estrdup("");
         r = insetrect(w->i->r, Selborder);
t@@ -247,6 +248,9 @@ winctl(void *arg)
                         alts[WMouseread].op = CHANSND;
                 else
                         alts[WMouseread].op = CHANNOP;
+                //        if(!w->scrolling && !w->mouseopen && w->qh>w->org+w->f.nchars)
+                //                alts[WCwrite].op = CHANNOP;
+                //        else
                 alts[WCwrite].op = CHANSND;
                 if(w->deleted || !w->wctlready)
                         alts[WWread].op = CHANNOP;
t@@ -365,7 +369,7 @@ winctl(void *arg)
                                 w->qh = qh;
                         }
                         nr = up - rp;
-                        scrolling = w->org <= w->qh && w->qh <= w->org + w->f.nchars;
+                        scrolling = w->scrolling && w->org <= w->qh && w->qh <= w->org + w->f.nchars;
                         w->qh = winsert(w, rp, nr, w->qh)+nr;
                         if(scrolling)
                                 wshow(w, w->qh);