--- rxvt-unicode/src/command.C 2023/05/06 06:47:29 1.601 +++ rxvt-unicode/src/command.C 2023/05/06 08:01:35 1.602 @@ -1283,8 +1283,8 @@ int x, y; bool release = ev.type == ButtonRelease; - x = Pixel2Col (ev.x) + 1; - y = Pixel2Row (ev.y) + 1; + x = 1 + clamp (Pixel2Col (ev.x), 0, ncol - 1); + y = 1 + clamp (Pixel2Row (ev.y), 0, nrow - 1); if (ev.type == MotionNotify) {