shithub: pplay

Download patch

ref: e893c82d20a3da889108d8f23ac157c1356f1bbb
parent: b4ff7edab93074c22d578cae30e8759278aeed09
author: qwx <qwx@sciops.net>
date: Thu Nov 17 08:22:05 EST 2022

redraw on edit

--- a/cmd.c
+++ b/cmd.c
@@ -288,7 +288,7 @@
 		setrange(dot.from.pos, dot.from.pos + c->bufsz);
 		totalsz += c->bufsz;
 	}
-	return 0;
+	return 1;
 }
 
 static int
@@ -305,7 +305,7 @@
 	splitdot();
 	totalsz -= p2c(dot.pos, nil)->bufsz;
 	holdchunk(1);
-	return 0;
+	return 1;
 }
 
 static int
@@ -440,7 +440,7 @@
 	case 'c': return copy(s);
 	case 'd': return cut(s);
 	case 'm': return forcemerge(s);
-//	case 'p': return paste(s);
+	case 'p': return paste(s);
 //	case 'r': return readfrom(s);
 	case 'w': return writeto(s);
 //	case 'x': return crop(s);
--- a/draw.c
+++ b/draw.c
@@ -184,9 +184,10 @@
 		r = view->r;
 		r.min.x += x;
 		r.max.x = r.min.x + 1;
-		draw(view, r, col[Cloop], nil, ZP);
+		view, r, col[Cloop], nil, ZP);
 	}
-	drawchunks();
+	if(debug)
+		drawchunks();
 }
 
 void
--- a/pplay.c
+++ b/pplay.c
@@ -151,11 +151,13 @@
 			default:
 				if((p = prompt(r)) == nil || strlen(p) == 0)
 					break;
-				if(cmd(p) < 0)
-					fprint(2, "cmd \"%s\" failed: %r\n", p);
-				break;
+				switch(cmd(p)){
+				case -1: fprint(2, "cmd \"%s\" failed: %r\n", p); break;
+				case 0: update(); break;
+				case 1: redraw(0); break;
+				case 2: redraw(1); break;
+				}
 			}
-			break;
 		}
 	}
 }