add bigtags
This commit is contained in:
parent
20ae0b0fc2
commit
f8dea3c178
5 changed files with 96 additions and 2 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue