shithub: orca

Download patch

ref: 13da40ba1c5622a70b16d09505617dc909bb7281
parent: 715c88f570f49e7c6729e2c3a71b819ae64a12d9
author: Sigrid Haflínudóttir <ftrvxmtrx@gmail.com>
date: Mon Feb 17 14:28:20 EST 2020

plan9: simplify menu

--- a/plan9.c
+++ b/plan9.c
@@ -84,12 +84,18 @@
 static long framedev; /* frame deviation in ms */
 static Rune *linebuf;
 
-static char *style[Numstyles] = {
-	[Sfancy] = "fancy",
-	[Splain] = "plain",
-	[Snone] = "no",
+static char *dotstyles[Numstyles] = {
+	[Sfancy] = "fancy dots",
+	[Splain] = "plain dots",
+	[Snone] = "no dots",
 };
 
+static char *rulerstyles[Numstyles] = {
+	[Sfancy] = "fancy rulers",
+	[Splain] = "plain rulers",
+	[Snone] = "no rulers",
+};
+
 static Rune dot[Numstyles] = {
 	[Sfancy] = L'·',
 	[Splain] = '.',
@@ -975,7 +981,6 @@
 				oldbuttons = m.buttons;
 				break;
 			}
-			oldbuttons = m.buttons;
 
 			if (m.buttons == 3) { /* cut */
 				selcopy();
@@ -983,9 +988,8 @@
 			} else if (m.buttons == 5) { /* paste */
 				selpaste();
 			} else if (m.buttons == 4) { /* menu */
-				menu3i[Menu3dotstyle] = tmp;
-				menu3i[Menu3rulerstyle] = 1 + menu3i[Menu3dotstyle] + sprintf(tmp, "%s dots", style[(dotstyle+1) % Numstyles]);
-				sprintf(menu3i[Menu3rulerstyle], "%s rulers", style[(rulerstyle+1) % Numstyles]);
+				menu3i[Menu3dotstyle] = dotstyles[(dotstyle+1) % Numstyles];
+				menu3i[Menu3rulerstyle] = rulerstyles[(rulerstyle+1) % Numstyles];
 				n = menuhit(3, mctl, &menu3, nil);
 				if (n == Menu3load || n == Menu3save) {
 					strncpy(tmp, filename, sizeof(tmp));