+ movelen = 0;
+ movesize = 80;
+ movebuf = snewn(movesize, char);
+ movelen = sprintf(movebuf, "%d%c", i, (int)button_char);
+ {
+ static enum { OFF, FIXED, ADAPTIVE, DUNNO } autofollow = DUNNO;
+ if (autofollow == DUNNO) {
+ const char *env = getenv("LOOPY_AUTOFOLLOW");
+ if (env && !strcmp(env, "off"))
+ autofollow = OFF;
+ else if (env && !strcmp(env, "fixed"))
+ autofollow = FIXED;
+ else if (env && !strcmp(env, "adaptive"))
+ autofollow = ADAPTIVE;
+ else
+ autofollow = OFF;
+ }
+
+ if (autofollow != OFF) {
+ int dotid;
+ for (dotid = 0; dotid < 2; dotid++) {
+ grid_dot *dot = (dotid == 0 ? e->dot1 : e->dot2);
+ grid_edge *e_this = e;
+
+ while (1) {
+ int j, n_found;
+ grid_edge *e_next = NULL;
+
+ for (j = n_found = 0; j < dot->order; j++) {
+ grid_edge *e_candidate = dot->edges[j];
+ int i_candidate = e_candidate - g->edges;
+ if (e_candidate != e_this &&
+ (autofollow == FIXED ||
+ state->lines[i] == LINE_NO ||
+ state->lines[i_candidate] != LINE_NO)) {
+ e_next = e_candidate;
+ n_found++;
+ }
+ }