aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/9term
diff options
context:
space:
mode:
authorRuss Cox <rsc@swtch.com>2011-10-12 13:19:04 -0400
committerRuss Cox <rsc@swtch.com>2011-10-12 13:19:04 -0400
commit210d461c87a6c5f598ef958b303a7f24d4e4a93b (patch)
tree542f2adb7c8c52a31360e6038b182ba344ad307c /src/cmd/9term
parent7064acbd104d7c1af5a94533213d2bb124a7a60e (diff)
parent7064acbd104d7c1af5a94533213d2bb124a7a60e (diff)
downloadplan9port-210d461c87a6c5f598ef958b303a7f24d4e4a93b.tar.gz
plan9port-210d461c87a6c5f598ef958b303a7f24d4e4a93b.tar.bz2
plan9port-210d461c87a6c5f598ef958b303a7f24d4e4a93b.zip
merge
Diffstat (limited to 'src/cmd/9term')
-rw-r--r--src/cmd/9term/9term.c20
-rw-r--r--src/cmd/9term/dat.h3
-rw-r--r--src/cmd/9term/fns.h2
-rw-r--r--src/cmd/9term/wind.c10
4 files changed, 25 insertions, 10 deletions
diff --git a/src/cmd/9term/9term.c b/src/cmd/9term/9term.c
index ed68ed19..5ca47b90 100644
--- a/src/cmd/9term/9term.c
+++ b/src/cmd/9term/9term.c
@@ -67,7 +67,7 @@ threadmain(int argc, char *argv[])
fontname = EARGF(usage());
break;
case 's':
- /* no-op */
+ scrolling = TRUE;
break;
case 'c':
cooked = TRUE;
@@ -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);
@@ -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;
@@ -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;
@@ -288,6 +288,7 @@ enum
Snarf,
Plumb,
Send,
+ Scroll,
Cook
};
@@ -298,6 +299,7 @@ char *menu2str[] = {
"plumb",
"send",
"cook",
+ "scroll",
nil
};
@@ -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
@@ -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
index 32b75414..c1af6592 100644
--- a/src/cmd/9term/dat.h
+++ b/src/cmd/9term/dat.h
@@ -132,6 +132,7 @@ struct Window
Rectangle lastsr;
int topped;
int notefd;
+ uchar scrolling;
Cursor cursor;
Cursor *cursorp;
uchar holding;
@@ -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
index cdb5ff6f..a0ae686a 100644
--- a/src/cmd/9term/fns.h
+++ b/src/cmd/9term/fns.h
@@ -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
index 40889900..f82cf153 100644
--- a/src/cmd/9term/wind.c
+++ b/src/cmd/9term/wind.c
@@ -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 */
};
@@ -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;
@@ -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("<unnamed>");
r = insetrect(w->i->r, Selborder);
@@ -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;
@@ -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);