shithub: orca

Download patch

ref: 8d326d8f39933da20d56c15f906cd6d5e28054bd
parent: 857c7c44307e8e8b5f7ec9a95f6e12edb161d234
author: Sigrid Haflínudóttir <ftrvxmtrx@gmail.com>
date: Mon Feb 17 08:49:29 EST 2020

plan9: rename grid -> rulers

--- a/plan9.c
+++ b/plan9.c
@@ -64,7 +64,7 @@
 };
 
 static int bpm = 120, apm = 120;
-static Point grid = {8, 8};
+static Point rulers = {8, 8};
 static int rulerstyle = Sfancy, dotstyle = Sfancy;
 
 static Rune *linebuf;
@@ -426,7 +426,7 @@
 				c = dot[dotstyle];
 
 			if (c == dot[dotstyle] && attr == 0) {
-				if ((x % grid.x) == 0 && (y % grid.y) == 0) {
+				if ((x % rulers.x) == 0 && (y % rulers.y) == 0) {
 					rx = !!x + (x + 1) / field.width;
 					ry = !!y + (y + 1) / field.height;
 					c = rulerstyle == Snone ? dot[dotstyle] : ruler[rulerstyle][ry*3+rx];
@@ -476,7 +476,7 @@
 	i = 0;
 	sprint(s, "%udx%ud", field.width, field.height);
 	i += runesprint(linebuf, "%-10s", s);
-	sprint(s, "%d/%d", grid.x, grid.y);
+	sprint(s, "%d/%d", rulers.x, rulers.y);
 	i += runesprint(linebuf+i, "%-9s", s);
 	sprint(s, "%lldf%c", MAX(0, tick), pause ? '~' : 0);
 	i += runesprint(linebuf+i, "%-9s", s);
@@ -692,18 +692,18 @@
 }
 
 static int
-snaplow(int n, int gridn)
+snaplow(int n, int rulern)
 {
 	n--;
-	n -= (n % gridn) > 0 ? (n % gridn) : gridn;
+	n -= (n % rulern) > 0 ? (n % rulern) : rulern;
 	return MAX(1, n+1);
 }
 
 static int
-snaphigh(int n, int gridn)
+snaphigh(int n, int rulern)
 {
-	n += gridn;
-	n -= n % gridn - 1;
+	n += rulern;
+	n -= n % rulern - 1;
 	return n;
 }
 
@@ -710,8 +710,8 @@
 static void
 screensize(int *w, int *h)
 {
-	*w = snaplow((Dx(screen->r) - 2*Txtoff) / glyphsz.x, grid.x);
-	*h = snaplow(((Dy(screen->r) - 2*Txtoff) - 3*glyphsz.y) / glyphsz.y, grid.y);
+	*w = snaplow((Dx(screen->r) - 2*Txtoff) / glyphsz.x, rulers.x);
+	*h = snaplow(((Dy(screen->r) - 2*Txtoff) - 3*glyphsz.y) / glyphsz.y, rulers.y);
 }
 
 static void
@@ -986,8 +986,8 @@
 				break;
 			case Kctl:
 				ctldown = key.down;
-				movex = ctldown ? grid.x : 1;
-				movey = ctldown ? grid.y : 1;
+				movex = ctldown ? rulers.x : 1;
+				movey = ctldown ? rulers.y : 1;
 				break;
 			case Kup:
 			case Kdown:
@@ -1099,32 +1099,32 @@
 				selpaste();
 				break;
 			case '[':
-				grid.x = MAX(4, grid.x-1);
+				rulers.x = MAX(4, rulers.x-1);
 				complete = true;
 				break;
 			case ']':
-				grid.x = MIN(16, grid.x+1);
+				rulers.x = MIN(16, rulers.x+1);
 				complete = true;
 				break;
 			case '{':
-				grid.y = MAX(4, grid.y-1);
+				rulers.y = MAX(4, rulers.y-1);
 				complete = true;
 				break;
 			case '}':
-				grid.y = MIN(16, grid.y+1);
+				rulers.y = MIN(16, rulers.y+1);
 				complete = true;
 				break;
 			case '(':
-				w = snaplow(w, grid.x);
+				w = snaplow(w, rulers.x);
 				break;
 			case ')':
-				w = snaphigh(w, grid.x);
+				w = snaphigh(w, rulers.x);
 				break;
 			case '_':
-				h = snaplow(h, grid.y);
+				h = snaplow(h, rulers.y);
 				break;
 			case '+':
-				h = snaphigh(h, grid.y);
+				h = snaphigh(h, rulers.y);
 				break;
 			case '>':
 				apm = ++bpm;