Commits

Evan Gates  committed f229c87

small view scrolling fixes

  • Participants
  • Parent commits 02c7801

Comments (0)

Files changed (1)

 	char c;
 	int i, j, print_flag = 0;
 
-	i = MIN(size / 2, i_org + rows / 2);
-	j = MIN(size / 2, j_org + cols / 2);
+	i = i_org ? i_org + rows / 2 : size / 2;
+	j = j_org ? j_org + rows / 2 : size / 2;
 
 	set.c_cc[VMIN] = 1;
 	tcsetattr(0, TCSANOW, &set);
 
 	for (cur = field_a, nxt = field_b, gen = 0; ; tmp = cur, cur = nxt, nxt = tmp, gen++) {
 		print();
+		usleep(1000000 / fps);
 		while (!paused && read(0, &c, sizeof(c)) > 0) {
 			switch (c) {
 				case 'c' : show_coord = !show_coord;               break;
 				case 'j' : i_org += (i_org + rows < size) ? 1 : 0; break;
 				case 'k' : i_org -= (i_org > 0)           ? 1 : 0; break;
 				case 'h' : j_org -= (j_org > 0)           ? 1 : 0; break;
-				case 'l' : j_org += (j_org + rows < size) ? 1 : 0; break;
+				case 'l' : j_org += (j_org + cols < size) ? 1 : 0; break;
 				case 'p' : paused = 1; break;
 				case 'q' : quit(0);
 			}
 		}
 		if (paused)
 			stop();
-		usleep(1000000 / fps);
 		for (i = 0; i < size; i++) {
 			for (j = 0; j < size; j++) {
 				for (k = i ? -1 : 0, sum = 0; k < 2 && i + k < size; k++) {