shithub: riscv

Download patch

ref: b099753597d2c3b3d150c686df5c16310168477e
parent: 639500b7487174176e315c25499cfabdd4a4af3c
author: Roberto E. Vargas Caballero <[email protected]>
date: Sun Jan 19 13:36:50 EST 2020

acme: Restore call to movetodel() in colclose

--- a/sys/src/cmd/acme/cols.c
+++ b/sys/src/cmd/acme/cols.c
@@ -112,7 +112,7 @@
 colclose(Column *c, Window *w, int dofree)
 {
 	Rectangle r;
-	int i;
+	int i, didmouse, up;
 
 	/* w is locked */
 	if(!c->safe)
@@ -126,7 +126,7 @@
 	w->tag.col = nil;
 	w->body.col = nil;
 	w->col = nil;
-	restoremouse(w);
+	didmouse = restoremouse(w);
 	if(dofree){
 		windelete(w);
 		winclose(w);
@@ -138,17 +138,24 @@
 		draw(screen, r, display->white, nil, ZP);
 		return;
 	}
+	up = 0;
 	if(i == c->nw){		/* extend last window down */
 		w = c->w[i-1];
 		r.min.y = w->r.min.y;
 		r.max.y = c->r.max.y;
 	}else{			/* extend next window up */
+		up = 1;
 		w = c->w[i];
 		r.max.y = w->r.max.y;
 	}
 	draw(screen, r, textcols[BACK], nil, ZP);
-	if(c->safe)
+	if(c->safe) {
+		if(!didmouse && up)
+			w->showdel = TRUE;
 		winresize(w, r, FALSE);
+		if(!didmouse && up)
+			movetodel(w);
+	}
 }
 
 void
--- a/sys/src/cmd/acme/fns.h
+++ b/sys/src/cmd/acme/fns.h
@@ -19,10 +19,11 @@
 char*	getname(Text*, Text*, Rune*, int, int);
 void	scrsleep(uint);
 void	savemouse(Window*);
-void	restoremouse(Window*);
+int	restoremouse(Window*);
 void	clearmouse(void);
 void	allwindows(void(*)(Window*, void*), void*);
 uint loadfile(int, uint, int*, int(*)(void*, uint, Rune*, int), void*);
+void	movetodel(Window*);
 
 Window*	errorwin(Mntdir*, int);
 Window*	errorwinforwin(Window*);
--- a/sys/src/cmd/acme/util.c
+++ b/sys/src/cmd/acme/util.c
@@ -367,12 +367,18 @@
 	mousew = w;
 }
 
-void
+int
 restoremouse(Window *w)
 {
-	if(mousew!=nil && mousew==w)
+	int did;
+
+	did = 0;
+	if(mousew!=nil && mousew==w) {
 		moveto(mousectl, prevmouse);
+		did = 1;
+	}
 	mousew = nil;
+	return did;
 }
 
 void