aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/9term/wind.c
diff options
context:
space:
mode:
authorRuss Cox <rsc@swtch.com>2011-04-27 13:18:07 -0400
committerRuss Cox <rsc@swtch.com>2011-04-27 13:18:07 -0400
commitba31ab3044765270d40c9da934dfc11e5f8b63c5 (patch)
treeb9b8bb263f822e990b53eb97384ba338a0036a66 /src/cmd/9term/wind.c
parent42ef984cf2514fedc4f9e2efe2876aa95d2d8579 (diff)
downloadplan9port-ba31ab3044765270d40c9da934dfc11e5f8b63c5.tar.gz
plan9port-ba31ab3044765270d40c9da934dfc11e5f8b63c5.tar.bz2
plan9port-ba31ab3044765270d40c9da934dfc11e5f8b63c5.zip
9term, acme: autoscroll
Ignore scroll/noscroll window setting. Instead, scroll when the write begins in or immediately after the displayed window content. In the new scrolling discipline, executing "Noscroll" is replaced by typing Page Up or using the mouse to scroll higher in the buffer, and executing "Scroll" is replaced by typing End or using the mouse to scroll to the bottom of the buffer. R=r, r2 http://codereview.appspot.com/4433060
Diffstat (limited to 'src/cmd/9term/wind.c')
-rw-r--r--src/cmd/9term/wind.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/cmd/9term/wind.c b/src/cmd/9term/wind.c
index 4cc9c207..aa7c8288 100644
--- a/src/cmd/9term/wind.c
+++ b/src/cmd/9term/wind.c
@@ -36,7 +36,7 @@ static Image *lightholdcol;
static Image *paleholdcol;
Window*
-wmk(Image *i, Mousectl *mc, Channel *ck, Channel *cctl, int scrolling)
+wmk(Image *i, Mousectl *mc, Channel *ck, Channel *cctl)
{
Window *w;
Rectangle r;
@@ -77,7 +77,6 @@ wmk(Image *i, Mousectl *mc, Channel *ck, Channel *cctl, int scrolling)
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);
@@ -192,7 +191,7 @@ winctl(void *arg)
{
Rune *rp, *bp, *up, *kbdr;
uint qh;
- int nr, nb, c, wid, i, npart, initial, lastb;
+ int nr, nb, c, wid, i, npart, initial, lastb, scrolling;
char *s, *t, part[UTFmax];
Window *w;
Mousestate *mp, m;
@@ -248,10 +247,7 @@ 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;
+ alts[WCwrite].op = CHANSND;
if(w->deleted || !w->wctlready)
alts[WWread].op = CHANNOP;
else
@@ -369,8 +365,9 @@ winctl(void *arg)
w->qh = qh;
}
nr = up - rp;
+ scrolling = w->org <= w->qh && w->qh <= w->org + w->f.nchars;
w->qh = winsert(w, rp, nr, w->qh)+nr;
- if(w->scrolling || w->mouseopen)
+ if(scrolling)
wshow(w, w->qh);
wsetselect(w, w->q0, w->q1);
wscrdraw(w);