more tweaks
This commit is contained in:
parent
77c5c852e4
commit
cd1d0ab0b5
4 changed files with 27 additions and 8 deletions
|
|
@ -287,6 +287,7 @@ readfile(Column *c, char *s)
|
|||
w->body.file->mod = FALSE;
|
||||
w->dirty = FALSE;
|
||||
winsettag(w);
|
||||
winresize(w, w->r, FALSE, TRUE);
|
||||
textscrdraw(&w->body);
|
||||
textsetselect(&w->tag, w->tag.file->b.nc, w->tag.file->b.nc);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -192,6 +192,7 @@ struct Text
|
|||
int ncachealloc;
|
||||
Rune *cache;
|
||||
int nofill;
|
||||
int needundo;
|
||||
};
|
||||
|
||||
uint textbacknl(Text*, uint, uint);
|
||||
|
|
|
|||
|
|
@ -859,6 +859,16 @@ texttype(Text *t, Rune r)
|
|||
u->cq0 = t->q0;
|
||||
else if(t->q0 != u->cq0+u->ncache)
|
||||
error("text.type cq1");
|
||||
/*
|
||||
* Change the tag before we add to ncache,
|
||||
* so that if the window body is resized the
|
||||
* commit will not find anything in ncache.
|
||||
*/
|
||||
if(u->what==Body && u->ncache == 0){
|
||||
u->needundo = TRUE;
|
||||
winsettag(t->w);
|
||||
u->needundo = FALSE;
|
||||
}
|
||||
textinsert(u, t->q0, rp, nr, FALSE);
|
||||
if(u != t)
|
||||
textsetselect(u, u->q0, u->q1);
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ wintaglines(Window *w, Rectangle r)
|
|||
int
|
||||
winresize(Window *w, Rectangle r, int safe, int keepextra)
|
||||
{
|
||||
int y, mouseintag;
|
||||
int oy, y, mouseintag, tagresized;
|
||||
Image *b;
|
||||
Point p;
|
||||
Rectangle br, r1;
|
||||
|
|
@ -141,7 +141,7 @@ if(0) fprint(2, "winresize %d %R safe=%d keep=%d h=%d\n", w->id, r, safe, keepex
|
|||
r1.max.y = min(r.max.y, r1.min.y + w->taglines*font->height);
|
||||
y = r1.max.y;
|
||||
mouseintag = ptinrect(mouse->xy, w->tag.all);
|
||||
if(1 || !safe || !w->tagsafe || !eqrect(w->tag.all, r1)){
|
||||
if(!safe || !w->tagsafe || !eqrect(w->tag.all, r1)){
|
||||
|
||||
w->taglines = wintaglines(w, r);
|
||||
w->tagsafe = TRUE;
|
||||
|
|
@ -151,8 +151,10 @@ if(0) fprint(2, "winresize %d %R safe=%d keep=%d h=%d\n", w->id, r, safe, keepex
|
|||
r1 = r;
|
||||
r1.max.y = min(r.max.y, r1.min.y + w->taglines*font->height);
|
||||
y = r1.max.y;
|
||||
tagresized = 0;
|
||||
if(1 || !safe || !eqrect(w->tag.all, r1)){
|
||||
if(0) fprint(2, "resize tag %R => %R", w->tag.all, r1);
|
||||
tagresized = 1;
|
||||
if(0) fprint(2, "resize tag %R => %R\n", w->tag.all, r1);
|
||||
textresize(&w->tag, r1, TRUE);
|
||||
if(0) fprint(2, "=> %R (%R)\n", w->tag.all, w->tag.fr.r);
|
||||
y = w->tag.fr.r.max.y;
|
||||
|
|
@ -175,7 +177,9 @@ if(0) fprint(2, "=> %R (%R)\n", w->tag.all, w->tag.fr.r);
|
|||
|
||||
r1 = r;
|
||||
r1.min.y = y;
|
||||
if(1 || !safe || !eqrect(w->body.all, r1)){
|
||||
if(tagresized || !safe || !eqrect(w->body.all, r1)){
|
||||
oy = y;
|
||||
if(0) fprint(2, "resizing body; safe=%d all=%R r1=%R\n", safe, w->body.all, r1);
|
||||
if(y+1+w->body.fr.font->height <= r.max.y){ /* room for one line */
|
||||
r1.min.y = y;
|
||||
r1.max.y = y+1;
|
||||
|
|
@ -187,11 +191,12 @@ if(0) fprint(2, "=> %R (%R)\n", w->tag.all, w->tag.fr.r);
|
|||
r1.min.y = y;
|
||||
r1.max.y = y;
|
||||
}
|
||||
if(0) fprint(2, "resize body %R => %R", w->body.all, r1);
|
||||
if(0) fprint(2, "resizing body; new r=%R; r1=%R\n", r, r1);
|
||||
w->r = r;
|
||||
w->r.max.y = textresize(&w->body, r1, keepextra);
|
||||
if(0) fprint(2, " => %R (%R; %R)\n", w->body.all, w->body.fr.r, w->r);
|
||||
if(0) fprint(2, "after textresize: body.all=%R\n", w->body.all);
|
||||
textscrdraw(&w->body);
|
||||
w->body.all.min.y = oy;
|
||||
}
|
||||
w->maxlines = min(w->body.fr.nlines, max(w->maxlines, w->body.fr.maxlines));
|
||||
return w->r.max.y;
|
||||
|
|
@ -446,7 +451,7 @@ winsettag1(Window *w)
|
|||
runemove(new+i, Ldelsnarf, 10);
|
||||
i += 10;
|
||||
if(w->filemenu){
|
||||
if(w->body.file->delta.nc>0 || w->body.ncache){
|
||||
if(w->body.needundo || w->body.file->delta.nc>0 || w->body.ncache){
|
||||
runemove(new+i, Lundo, 5);
|
||||
i += 5;
|
||||
}
|
||||
|
|
@ -523,9 +528,11 @@ winsettag1(Window *w)
|
|||
br.max.x = br.min.x + Dx(b->r);
|
||||
br.max.y = br.min.y + Dy(b->r);
|
||||
draw(screen, br, b, nil, b->r.min);
|
||||
if(resize)
|
||||
if(resize){
|
||||
w->tagsafe = 0;
|
||||
winresize(w, w->r, TRUE, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
winsettag(Window *w)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue