diff options
author | rsc <devnull@localhost> | 2005-12-16 15:14:14 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2005-12-16 15:14:14 +0000 |
commit | f8dea3c178590517e6f8833a2953c10c31ddbffc (patch) | |
tree | 4f73e5b2e8e6b3478535e069b251edda4e9b4c42 /src/cmd/acme/text.c | |
parent | 20ae0b0fc25448245b75e0bd7b30b2fd29525165 (diff) | |
download | plan9port-f8dea3c178590517e6f8833a2953c10c31ddbffc.tar.gz plan9port-f8dea3c178590517e6f8833a2953c10c31ddbffc.tar.bz2 plan9port-f8dea3c178590517e6f8833a2953c10c31ddbffc.zip |
add bigtags
Diffstat (limited to 'src/cmd/acme/text.c')
-rw-r--r-- | src/cmd/acme/text.c | 53 |
1 files changed, 52 insertions, 1 deletions
diff --git a/src/cmd/acme/text.c b/src/cmd/acme/text.c index a2ba0265..adde0dd7 100644 --- a/src/cmd/acme/text.c +++ b/src/cmd/acme/text.c @@ -646,11 +646,21 @@ texttype(Text *t, Rune r) uint q0, q1; int nnb, nb, n, i; int nr; + Point p; Rune *rp; Text *u; - if(t->what!=Body && r=='\n') +/* + * TAG + * Used to disallow \n in tag here. + * Also if typing in tag, mark that resize might be necessary. + */ + if(t->what!=Body && t->what!=Tag && r=='\n') return; + if(t->what == Tag) + t->w->tagsafe = FALSE; +/* END TAG */ + nr = 1; rp = &r; switch(r){ @@ -667,9 +677,17 @@ texttype(Text *t, Rune r) } return; case Kdown: +/* TAG */ + if(t->what == Tag) + goto Tagdown; +/* END TAG */ n = t->fr.maxlines/3; goto case_Down; case Kscrollonedown: +/* TAG */ + if(t->what == Tag) + goto Tagdown; +/* END TAG */ n = mousescrollsize(t->fr.maxlines); if(n <= 0) n = 1; @@ -681,9 +699,17 @@ texttype(Text *t, Rune r) textsetorigin(t, q0, TRUE); return; case Kup: +/* TAG */ + if(t->what == Tag) + goto Tagup; +/* END TAG */ n = t->fr.maxlines/3; goto case_Up; case Kscrolloneup: +/* TAG */ + if(t->what == Tag) + goto Tagup; +/* END TAG */ n = mousescrollsize(t->fr.maxlines); goto case_Up; case Kpgup: @@ -715,6 +741,31 @@ texttype(Text *t, Rune r) q0++; textshow(t, q0, q0, TRUE); return; +/* TAG policy here */ + Tagdown: + /* expand tag to show all text */ + if(!t->w->tagexpand){ + t->w->tagexpand = TRUE; + winresize(t->w, t->w->r, FALSE, TRUE); + } + return; + + Tagup: + /* shrink tag to single line */ + if(t->w->tagexpand){ + t->w->tagexpand = FALSE; + t->w->taglines = 1; + /* move mouse to stay in tag */ + p = mouse->xy; + if(ptinrect(p, t->w->tag.all) + && !ptinrect(p, t->w->tagtop)){ + p.y = t->w->tagtop.min.y + Dy(t->w->tagtop)/2; + moveto(mousectl, p); + } + winresize(t->w, t->w->r, FALSE, TRUE); + } + return; +/* END TAG */ } if(t->what == Body){ seq++; |