acme: Restore call to movetodel() in colclose

This commit is contained in:
Roberto E. Vargas Caballero 2020-01-19 18:36:50 +01:00
parent 639500b748
commit b099753597
3 changed files with 20 additions and 6 deletions

View file

@ -112,7 +112,7 @@ void
colclose(Column *c, Window *w, int dofree) colclose(Column *c, Window *w, int dofree)
{ {
Rectangle r; Rectangle r;
int i; int i, didmouse, up;
/* w is locked */ /* w is locked */
if(!c->safe) if(!c->safe)
@ -126,7 +126,7 @@ colclose(Column *c, Window *w, int dofree)
w->tag.col = nil; w->tag.col = nil;
w->body.col = nil; w->body.col = nil;
w->col = nil; w->col = nil;
restoremouse(w); didmouse = restoremouse(w);
if(dofree){ if(dofree){
windelete(w); windelete(w);
winclose(w); winclose(w);
@ -138,17 +138,24 @@ colclose(Column *c, Window *w, int dofree)
draw(screen, r, display->white, nil, ZP); draw(screen, r, display->white, nil, ZP);
return; return;
} }
up = 0;
if(i == c->nw){ /* extend last window down */ if(i == c->nw){ /* extend last window down */
w = c->w[i-1]; w = c->w[i-1];
r.min.y = w->r.min.y; r.min.y = w->r.min.y;
r.max.y = c->r.max.y; r.max.y = c->r.max.y;
}else{ /* extend next window up */ }else{ /* extend next window up */
up = 1;
w = c->w[i]; w = c->w[i];
r.max.y = w->r.max.y; r.max.y = w->r.max.y;
} }
draw(screen, r, textcols[BACK], nil, ZP); draw(screen, r, textcols[BACK], nil, ZP);
if(c->safe) if(c->safe) {
if(!didmouse && up)
w->showdel = TRUE;
winresize(w, r, FALSE); winresize(w, r, FALSE);
if(!didmouse && up)
movetodel(w);
}
} }
void void

View file

@ -19,10 +19,11 @@ void undo(Text*, Text*, Text*, int, int, Rune*, int);
char* getname(Text*, Text*, Rune*, int, int); char* getname(Text*, Text*, Rune*, int, int);
void scrsleep(uint); void scrsleep(uint);
void savemouse(Window*); void savemouse(Window*);
void restoremouse(Window*); int restoremouse(Window*);
void clearmouse(void); void clearmouse(void);
void allwindows(void(*)(Window*, void*), void*); void allwindows(void(*)(Window*, void*), void*);
uint loadfile(int, uint, int*, int(*)(void*, uint, Rune*, int), void*); uint loadfile(int, uint, int*, int(*)(void*, uint, Rune*, int), void*);
void movetodel(Window*);
Window* errorwin(Mntdir*, int); Window* errorwin(Mntdir*, int);
Window* errorwinforwin(Window*); Window* errorwinforwin(Window*);

View file

@ -367,12 +367,18 @@ savemouse(Window *w)
mousew = w; mousew = w;
} }
void int
restoremouse(Window *w) restoremouse(Window *w)
{ {
if(mousew!=nil && mousew==w) int did;
did = 0;
if(mousew!=nil && mousew==w) {
moveto(mousectl, prevmouse); moveto(mousectl, prevmouse);
did = 1;
}
mousew = nil; mousew = nil;
return did;
} }
void void