Commits

Brodie Rao committed cfd7060

Ensure coordinate characters in mouse response never exceed 255

xterm mouse reporting is limited to 223 columns/rows as each position
is encoded in a single character as value + 32.

Comments (0)

Files changed (1)

     if (modflag & NSControlKeyMask) cb |= 16;
     if (motion) cb += 32;
 
+    x = MIN(x + 33, 255);
+    y = MIN(y + 33, 255);
+
     char buf[MOUSE_RESPONSE_LEN + 1];
-    snprintf(buf, sizeof(buf), MOUSE_RESPONSE, cb, 32 + x + 1,
-             32 + y + 1);
+    snprintf(buf, sizeof(buf), MOUSE_RESPONSE, cb, x, y);
     return [NSData dataWithBytes: buf length: MOUSE_RESPONSE_LEN];
 }