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/wind.c | |
| parent | 20ae0b0fc25448245b75e0bd7b30b2fd29525165 (diff) | |
| download | plan9port-f8dea3c178590517e6f8833a2953c10c31ddbffc.tar.gz plan9port-f8dea3c178590517e6f8833a2953c10c31ddbffc.zip | |
add bigtags
Diffstat (limited to 'src/cmd/acme/wind.c')
| -rw-r--r-- | src/cmd/acme/wind.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/cmd/acme/wind.c b/src/cmd/acme/wind.c index 4fb03ef9..05384601 100644 --- a/src/cmd/acme/wind.c +++ b/src/cmd/acme/wind.c @@ -100,17 +100,28 @@ wintaglines(Window *w, Rectangle r) int n; Rune rune; +/* TAG policy here */ + if(!w->tagexpand) return 1; w->tag.fr.noredraw = 1; textresize(&w->tag, r, TRUE); w->tag.fr.noredraw = 0; + + /* can't use more than we have */ if(w->tag.fr.nlines >= w->tag.fr.maxlines) return w->tag.fr.maxlines; + + /* if tag ends with \n, include empty line at end for typing */ n = w->tag.fr.nlines; bufread(&w->tag.file->b, w->tag.file->b.nc-1, &rune, 1); if(rune == '\n') n++; + + /* cannot magically shrink tag - would lose focus */ + if(n < w->taglines) + n = w->taglines; + return n; } @@ -125,6 +136,19 @@ if(0) fprint(2, "winresize %d %R safe=%d keep=%d h=%d\n", w->id, r, safe, keepex w->tagtop = r; w->tagtop.max.y = r.min.y+font->height; +/* + * TAG If necessary, recompute the number of lines that should + * be in the tag. + */ + r1 = r; + r1.max.y = min(r.max.y, r1.min.y + w->taglines*font->height); + y = r1.max.y; + if(1 || !safe || !w->tagsafe || !eqrect(w->tag.all, r1)){ + w->taglines = wintaglines(w, r); + w->tagsafe = TRUE; + } +/* END TAG */ + r1 = r; r1.max.y = min(r.max.y, r1.min.y + w->taglines*font->height); y = r1.max.y; @@ -141,6 +165,7 @@ if(0) fprint(2, "=> %R (%R)\n", w->tag.all, w->tag.fr.r); br.max.y = br.min.y + Dy(b->r); draw(screen, br, b, nil, b->r.min); } + r1 = r; r1.min.y = y; |
