shithub: orca

Download patch

ref: 3ee1abfee2c681bef131cc43c5171e199eebf47e
parent: a50d6147f272215e7b4ead57975da2fdfb18da0a
author: Sigrid Haflínudóttir <ftrvxmtrx@gmail.com>
date: Mon Feb 17 05:46:47 EST 2020

plan9: remove selw and selh

--- a/plan9.c
+++ b/plan9.c
@@ -72,7 +72,6 @@
 static int bpm = 120, apm = 120;
 static Point cur;
 static Rectangle sel;
-static int selw, selh;
 static int charw, charh;
 static Field field;
 static Mbuf_reusable mbuf, mscr;
@@ -496,7 +495,7 @@
 	i = 0;
 	sprint(s, "%ud,%ud", cur.x, cur.y);
 	i += runesprint(linebuf, "%-10s", s);
-	sprint(s, "%d:%d", selw, selh);
+	sprint(s, "%d:%d", sel.min.x < cur.x ? -Dx(sel) : Dx(sel), sel.max.x < cur.x ? -Dy(sel) : Dy(sel));
 	i += runesprint(linebuf+i, "%-9s", s);
 	i += runesprint(linebuf+i, "%-9s", modes[altdown ? Mslide : mode]);
 	i += runesprint(linebuf+i, "%s", filename[0] ? filename : "unnamed");
@@ -514,9 +513,8 @@
 		werrstr(field_load_error_string(e));
 		return -1;
 	}
-	memset(&cur, 0, sizeof(cur));
-	memset(&sel, 0, sizeof(sel));
-	selw = selh = 0;
+	cur = ZP;
+	sel = ZR;
 
 	return 0;
 }
@@ -643,9 +641,6 @@
 	cur = ptfield(addpt(cur, xy));
 	sel.min = ptfield(addpt(sel.min, xy));
 	sel.max = ptfield(addpt(sel.max, xy));
-
-	selw = selw < 0 ? sel.min.x - sel.max.x : sel.max.x - sel.min.x;
-	selh = selh < 0 ? sel.min.y - sel.max.y : sel.max.y - sel.min.y;
 }
 
 static void
@@ -818,9 +813,6 @@
 	sel.max.x = MAX(0, MIN((int)field.width-1, sel.max.x));
 	sel.min.y = MAX(0, MIN((int)field.height-1, sel.min.y));
 	sel.max.y = MAX(0, MIN((int)field.height-1, sel.max.y));
-
-	selw = selw < 0 ? sel.min.x - sel.max.x : sel.max.x - sel.min.x;
-	selh = selh < 0 ? sel.min.y - sel.max.y : sel.max.y - sel.min.y;
 }
 
 void
@@ -1108,7 +1100,6 @@
 				else {
 					sel.min = cur;
 					sel.max = cur;
-					selw = selh = 0;
 				}
 				break;
 			case Kack: /* C-f */