shithub: ham

Download patch

ref: a843b3cd35b6b21b382c7dd469c4aa2835eda2c9
parent: c10c1a587521d858c33ae96376c7bcf58563aec6
author: kvik <kvik@a-b.xyz>
date: Mon Feb 3 17:59:37 EST 2020

Write and close apply promptly to the pointed-to window

--- a/samterm/menu.c
+++ b/samterm/menu.c
@@ -155,34 +155,26 @@
 		break;
 
 	case Close:
-		if(!hostlock){
-			setcursor(mousectl, &bullseye);
-			buttons(Down);
-			if((mousep->buttons&4) && (l = flwhich(mousep->xy)) && !hostlock){
-				t=(Text *)l->user1;
-				if (t->nwin>1)
-					closeup(l);
-				else if(t!=&cmd) {
-					outTs(Tclose, t->tag);
-					setlock();
-				}
-			}
-			setcursor(mousectl, cursor);
-			buttons(Up);
+		if(hostlock)
+			break;
+		if((l = flwhich(mousep->xy)) == nil)
+			break;
+		t=(Text *)l->user1;
+		if (t->nwin>1)
+			closeup(l);
+		else if(t!=&cmd) {
+			outTs(Tclose, t->tag);
+			setlock();
 		}
 		break;
 
 	case Write:
-		if(!hostlock){
-			setcursor(mousectl, &bullseye);
-			buttons(Down);
-			if((mousep->buttons&4) && (l = flwhich(mousep->xy))){
-				outTs(Twrite, ((Text *)l->user1)->tag);
-				setlock();
-			}else
-				setcursor(mousectl, cursor);
-			buttons(Up);
-		}
+		if(hostlock)
+			break;
+		if((l = flwhich(mousep->xy)) == nil)
+			break;
+		outTs(Twrite, ((Text *)l->user1)->tag);
+		setlock();
 		break;
 
 	default: